Media transfer with IAX

I shall try to put this question as succinctly as possible, but if anyone needs further information - just ask!

I have one main asterisk installation in the US. Until recently, I was registering all my SIP providers on this server, including those in the UK and France. This worked, but it meant that if someone in London wanted to call me and I was next door, the call would pass to Voiptalk, to my asterisk server in the US, then to my phone back in London. This is clearly two transatlantic trips too many.

So, I am experimenting with a secondary server in France, connected via IAX to the US. It all works in the sense that I can make and receive calls, but I want the US server to continue to handle call setup, so I don’t have to duplicate and maintain two versions of the dialplan, the AstDB, the MySQL cdr, etc. So what I would like to happen, for example when someone calls a London number:
[ul][li]Call is passed via Voiptalk to my Asterisk server in France[/li]
[li]Call is passed via IAX to asterisk/US.[/li]
[li]Asterisk/US decides, based on a number of parameters, how to route the call, i.e. which phones to ring[/li]
[li]If the phone list includes phones in Europe, the call is routed back via the IAX link to asterisk/FR.[/li]
[li]If answered, the media is transferred to asterisk/FR, so at worst the media stream is routed via asterisk/FR and bypasses asterisk/US.[/li][/ul]

I may have achieved this, but I’m not sure about the media transfer part. This it what happens on the US server:

    -- Called PR/Dum1
Rx-Frame Retry[ No] -- OSeqno: 009 ISeqno: 006 Type: IAX     Subclass: ACK
   Timestamp: 10006ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[Yes] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: CTOKEN
   Timestamp: 00007ms  SCall: 00001  DCall: 21578 [1.2.3.4:4569]
   Unknown IE 054  : Present

Rx-Frame Retry[ No] -- OSeqno: 009 ISeqno: 007 Type: IAX     Subclass: ACK
   Timestamp: 09823ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 009 ISeqno: 007 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 10242ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 010 ISeqno: 007 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 10245ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 011 ISeqno: 008 Type: IAX     Subclass: LAGRP
   Timestamp: 10018ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: AUTHREQ
   Timestamp: 00009ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
   AUTHMETHODS     : 3
   CHALLENGE       : \x36\x39\x39\x34\x34\x34\x38\x33\x39
   USERNAME        : PC

Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: ACCEPT
   Timestamp: 00222ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
   FORMAT          : 4
   Unknown IE 056  : Present

    -- Call accepted by 1.2.3.4 (format ulaw)
    -- Format for call is ulaw
Rx-Frame Retry[ No] -- OSeqno: 002 ISeqno: 002 Type: CONTROL Subclass: RINGING
   Timestamp: 00225ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
    -- IAX2/PR-21578 is ringing
Rx-Frame Retry[ No] -- OSeqno: 012 ISeqno: 009 Type: IAX     Subclass: ACK
   Timestamp: 10465ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 012 ISeqno: 009 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 10882ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 013 ISeqno: 009 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 10885ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 003 ISeqno: 002 Type: CONTROL Subclass: RINGING
   Timestamp: 01338ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
    -- IAX2/PR-21578 is ringing
Rx-Frame Retry[ No] -- OSeqno: 004 ISeqno: 002 Type: CONTROL Subclass: (255?)
   Timestamp: 03102ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 005 ISeqno: 002 Type: CONTROL Subclass: ANSWER
   Timestamp: 03105ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
    -- IAX2/PR-21578 answered IAX2/PR-3004
Rx-Frame Retry[ No] -- OSeqno: 006 ISeqno: 002 Type: CONTROL Subclass: (255?)
   Timestamp: 03108ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 007 ISeqno: 002 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 03111ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 008 ISeqno: 002 Type: VOICE   Subclass: 4
   Timestamp: 03144ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 014 ISeqno: 010 Type: IAX     Subclass: ACK
   Timestamp: 13341ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 014 ISeqno: 010 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 13742ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 015 ISeqno: 010 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 13745ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 014 ISeqno: 011 Type: IAX     Subclass: ACK
   Timestamp: 13344ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 016 ISeqno: 011 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 13748ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 017 ISeqno: 011 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 13751ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 006 ISeqno: 003 Type: IAX     Subclass: ACK
   Timestamp: 03509ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 009 ISeqno: 003 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 03327ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 010 ISeqno: 003 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 03330ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 014 ISeqno: 012 Type: IAX     Subclass: ACK
   Timestamp: 13347ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 006 ISeqno: 004 Type: IAX     Subclass: ACK
   Timestamp: 03512ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 014 ISeqno: 013 Type: IAX     Subclass: ACK
   Timestamp: 13350ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 018 ISeqno: 013 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 13768ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 019 ISeqno: 013 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 13771ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 014 ISeqno: 014 Type: IAX     Subclass: ACK
   Timestamp: 13353ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 020 ISeqno: 014 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 13774ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 021 ISeqno: 014 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 13777ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 007 ISeqno: 005 Type: IAX     Subclass: ACK
   Timestamp: 03515ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 011 ISeqno: 005 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 03335ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 012 ISeqno: 005 Type: CONTROL Subclass: SRCUPDT
   Timestamp: 03338ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 013 ISeqno: 005 Type: IAX     Subclass: TXREADY
   Timestamp: 03347ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
   CALL NUMBER     : 1082

    -- Channel 'IAX2/PR-21578' ready to transfer
Rx-Frame Retry[ No] -- OSeqno: 014 ISeqno: 015 Type: IAX     Subclass: ACK
   Timestamp: 13356ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 007 ISeqno: 006 Type: IAX     Subclass: ACK
   Timestamp: 03518ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 014 ISeqno: 016 Type: IAX     Subclass: ACK
   Timestamp: 13359ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 022 ISeqno: 016 Type: IAX     Subclass: TXREADY
   Timestamp: 13805ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
   CALL NUMBER     : 17363

    -- Channel 'IAX2/PR-3004' ready to transfer
Rx-Frame Retry[ No] -- OSeqno: 014 ISeqno: 006 Type: IAX     Subclass: TXREADY
   Timestamp: 03365ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
   CALL NUMBER     : 1082

Rx-Frame Retry[ No] -- OSeqno: 008 ISeqno: 007 Type: IAX     Subclass: ACK
   Timestamp: 03560ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 009 ISeqno: 008 Type: IAX     Subclass: ACK
   Timestamp: 03743ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 009 ISeqno: 009 Type: IAX     Subclass: ACK
   Timestamp: 03746ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 009 ISeqno: 010 Type: IAX     Subclass: ACK
   Timestamp: 03749ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 009 ISeqno: 011 Type: IAX     Subclass: ACK
   Timestamp: 03752ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 018 ISeqno: 017 Type: IAX     Subclass: ACK
   Timestamp: 13543ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 018 ISeqno: 018 Type: IAX     Subclass: ACK
   Timestamp: 13546ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 011 ISeqno: 012 Type: IAX     Subclass: ACK
   Timestamp: 03755ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 011 ISeqno: 013 Type: IAX     Subclass: ACK
   Timestamp: 03758ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 011 ISeqno: 014 Type: IAX     Subclass: ACK
   Timestamp: 03761ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 011 ISeqno: 015 Type: IAX     Subclass: ACK
   Timestamp: 03764ms  SCall: 01082  DCall: 21578 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 022 ISeqno: 019 Type: IAX     Subclass: ACK
   Timestamp: 13549ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]
Rx-Frame Retry[ No] -- OSeqno: 022 ISeqno: 020 Type: IAX     Subclass: ACK
   Timestamp: 13552ms  SCall: 17363  DCall: 03004 [1.2.3.4:4569]

As you see, I get Channel ‘IAX2/PR-21578’ ready to transfer and Channel ‘IAX2/PR-3004’ ready to transfer, but no indication that the transfer has been made. So how can I tell if the media is being routed via the server in France? I suppose I’m looking for an IAX equivalent of “rtp set debug on” so I can see where the media steam is going.

Here are my definitions from iax.conf:

[PR]
type=friend
username=PC
secret=hush
host=xxxx
context=from-paris
qualify=yes
trunk=yes
allow=ulaw
allow=alaw
allow=g729
transfer=mediaonly

And in France:

[PC]
type=friend
username=PR
secret=hush
host=xxxx
context=phones
qualify=yes
trunk=yes
allow=ulaw
allow=alaw
allow=g729
transfer=mediaonly

Thanks,
Ian

I think it’s the absence of any further messages that indicates the call has been transferred, since sometimes I get this:

Called PR/voipxxx -- Call accepted by x.x.x.x(format ulaw) -- Format for call is ulaw -- IAX2/PR-18856 is ringing -- IAX2/PR-12232 requested special control 20, passing it to IAX2/PR-18856 -- IAX2/PR-12232 requested special control 20, passing it to IAX2/PR-18856 -- IAX2/PR-18856 stopped sounds -- IAX2/PR-18856 answered IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232 -- Channel 'IAX2/PR-12232' ready to transfer -- Channel 'IAX2/PR-18856' ready to transfer -- Attempting media bridge of IAX2/PR-18856 and IAX2/PR-12232

which seems to indicate asterisk/US cannot transfer the media for some reason…