Tip: matching inbound calls from provider to context


Hi All,
The following always stumped me:

Quoting The Wiki:

This is not entirely complete.
If no username is available, then Asterisk will try to match on IP AND PORT !

This is relevant to configurations where you receive calls from a provider.

sip.conf (wrong version)

context=From_SIP ; Default context for incoming calls

[Sippy] ; a SER server
host= ; SER server’s IP address (faked)


; nothing here…

exten => 5000,1,Milliwatt() ; toooootttt
exten => 5000,2,Hangup()[/quote]

Sip debug output on asterisk:

Found no matching peer or user for '’
Looking for 5000 in From_SIP <=default(wrong) context
Reliably Transmitting (no NAT):
SIP/2.0 404 Not Found

As you can see, the call lands in the [From_SIP] context, NOT in the [from-provider] context

From this output we learn the Port# the SER is using: 5061
Add this as ‘port=5061’ in the [Sippy] section, reload sip and make a new call:

[quote][Sippy] ; a SER server
host= ; SER server’s IP address (faked)
port=5061 ; UDP port the SER is listening on

Sip debug output:
Sending to : 5061 (non-NAT)
Found peer ‘Sippy’ < Ahaaaa !!!
Looking for 5000 in from-provider < That’s the context I want the call to land in !!

Erm… I’m winking in and out of toying around with Asterisk. The above applies to Asterisk pre-version 2. Don’t know if the behaviour in version 2 has changed in this respect. :laughing:
Figuring this out has cost me quite some time, I hope this helps someone