Match numbers coming from a voip trunk


#1

Ok I have looked for the answer but can’t seem to find it and to be honest I’m not really sure what I’m looking for. But what I want to do is match incoming calls coming from a voip provider so that I can do different things with the incoming numbers. The pattern matching doesn’t work cause the call always comes from the voip provider, however I know the number is getting passed along somewhere because when it rings to a phone the right CID is displayed and also the sip log show call from XXXXXXXXX and the number is correct. So where can I find this info so that I can distribute incoming calls similar to pattern matching?


#2

This depends from Your provider.
What You can do to find out the target, the provider is sending the call to is issuing a sip set debug and trigger an incoming call through the provider after this. The debug output on the cli should give You the answer (TO-Header of the SIP-packet or - if applicable - P-Asserted-Identity or P-Preferred-Identity Headers).


#3

If the phone is displaying the number, ${CALLERID(num)} should be enough. Actually, I would have thought that the / syntax in the dialplan extension field would work if the phone was receiving a valid network caller ID.

There is nothing inevitable about getting the service provider’s number in various fields, which is why you were asked to provide the debug output, to work out how your provider actually works. Some of the rest of that reply seems to have assumed you wanted DNID, but I think you want CLID.

Incidentally, Asterisk doesn’t have concept of a VoIP trunk; only the GUIs do.

Finally, this should have been asked in Asterisk Support.


#4

Sorry for posting in the wrong section, and what is it called if it isn’t a trunk? Just curious I’m just starting out and trying to figure some things out. Here the debug output the numbers 7805555555 is the number that is calling and 7805555556 is the providers DID number.

<--- SIP read from UDP:69.147.236.82:5060 --->
INVITE sip:7805555556@xxx.xxx.xxx.xxx:5060 SIP/2.0
Via: SIP/2.0/UDP 69.147.236.82:5060;branch=z9hG4bK0628a649;rport
From: "7805555555" <sip:7805555555@69.147.236.82>;tag=as76a4ffee
To: <sip:7805555556@xxx.xxx.xxx.xxx.237:5060>
Contact: <sip:78055555@69.147.236.82>
Call-ID: 77a38251435926b0480325d90181ef0e@69.147.236.82
CSeq: 102 INVITE
User-Agent: VoIPMS/SERAST
Max-Forwards: 70
Remote-Party-ID: "7805555555" <sip:7805555555@69.147.236.82>;privacy=off;screen=no
Date: Sat, 03 Sep 2011 15:50:43 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces
Content-Type: application/sdp
Content-Length: 240

v=0
o=root 3017 3017 IN IP4 69.147.236.82
s=session
c=IN IP4 69.147.236.82
t=0 0
m=audio 19048 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

Anyway thanks the CALLERID(num) works I just implemented it wrong when I tried it the first time. Thanks.


#5

It’s a user agent which supports multiple simultaneous calls, but most phones support more than one simultaneous call.

Setting both To and From to the same think is not very helpful, but they are using Remote-Party-ID, so, as long as you have trustrpid set, you should be OK.