Responding to SIP 300 Multiple Choice

I am trying to set up my asterisk server to get external routing instructions in the form of SIP 300 multiple choice messages. The 300 message is coming back with the carrier name as the host in the contact field like I would expect it to, but I am not sure how to capture it and send the call to the correct peer.
contact URI from SIP 300: Contact:

These are the messages I am getting from the server asterisk server after the SIP 300 comes in. 19705551212 is the number i sent and testC is the context that the calls from the redirect server originated from.
[Jan 23 22:40:28] NOTICE[2540]: chan_local.c:899 local_call: No such extension/context 19705551212@testC while calling Local channel
[Jan 23 22:40:28] NOTICE[2540]: app_dial.c:971 do_forward: Forwarding failed to dial ‘Local/19705551212@testC’

I think i need to parse the host from the contact URI in the SIP 300 and match it to a string and then send it to a SIP peer. I could probably figure out the marco to do this, but how do I get to the macro in the dial plan to analyze the SIP 300? Or is there something easier?


I am not too clear what you are doing, and I have never used 30x other than 302, but I suspect you want to use promiscuous redirect mode.

fantastic, promiscredir= yes in sip.conf allowed me to at least react to the redirects, as long as the host in the contact URI on the redirect is my local host.

I am still struggling to figure out how to inspect some sort of yet-to-be-determined tag in the contact URI that comes back so that I know which carrier I want to try. It is not as simple as just using the actual host/ip address of the carrier from the contact URI because i need to send them via an IP trunk group with authentication.

Here is the relevant part from my extensions.conf. NGN is an IP trunk group to the redirect server:

;Send test call to redirect server
exten => 2,1,NoOp()
same => n,Verbose(“In the sandbox”)
same => n,Verbose("Someone dialed “${EXTEN}” "${SIPDOMAIN})
same => n,Verbose(${CHANNEL(uri)})
same => n,Dial(SIP/19705551212@NGN)

;send redirected call back
exten => 19705551212,1,NoOp()
same => n,Verbose(“back In the sandbox”)
same => n,Verbose(${CHANNEL(uri)})
same => n,Dial(IP/Thing1)

And here is what I see in the CLI, with debug and verbose cranked up
== Using SIP RTP CoS mark 5
– Executing [2@TestC:1] NoOp(“SIP/sandbox-00000032”, “”) in new stack
– Executing [2@TestC:2] Verbose(“SIP/sandbox-00000032”, ““In the sandbox””) in new stack
In the sandbox
– Executing [2@TestC:3] Verbose(“SIP/sandbox-00000032”, ""Someone dialed “2” “”) in new stack
Someone dialed 2
– Executing [2@TestC:4] Verbose(“SIP/sandbox-00000032”, “sip:sandbox@”) in new stack
– Executing [2@TestC:5] Dial(“SIP/sandbox-00000032”, “SIP/19705551212@NGN”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/19705551212@NGN
– Got SIP response 300 “Multiple Choices” back from
– Now forwarding SIP/sandbox-00000032 to ‘SIP/19705551212::::UDP@’ (thanks to SIP/NGN-00000033)
== Using SIP RTP CoS mark 5

I know that it is hitting the 19705551212 extension because it rings that phone (tHING1), but none of the second round of Verbose messages show up!
FYI is what i am using for the redirect server and is the IP of my server.

Thanks for your help!

I still don’t understand what you are trying to do and promiscuous redirect may not be what you want. Please read what it actually does. Generally you use it when you are getting redirects that are not for your domain and you want the user part interpreted by the system that does own that domain.