Inbound Dial Plan: Detect dialed destination number

Support zone
Post Reply
marcjohnson
Posts: 7
Joined: Fri Apr 23, 2010 4:14 pm

Inbound Dial Plan: Detect dialed destination number

Post by marcjohnson » Tue Apr 27, 2010 3:32 am

Within an inbound ("sys.In") dial plan... does anyone know how to detect the dialed number (the destination number, NOT caller id)?

I know with outbound you can simply look at req.URI.User.to_s, but not the case with inbound... the latter returns sip info (instead of the phone #).

For example if you dial my phone number YYYY, which in turn triggers my inbound dial plan... I want to print out number YYYY.

Should be simple, right?

I've already looked at these to no avail:
req.URI - The SIP URI for the incoming request.
req.URI.User - The user portion of the request URI this is the value used in the non-Ruby dial plans as ${EXTEN} or ${dst}.
req.URI.Host - The host portion of the request URI.
req.Header - The SIP Headers for the incoming request.
req.Header.From - The SIP From header for the incoming request.
req.Header.From.FromURI - The URI portion of the From header.
req.Header.From.FromName - The name portion of the From header.
req.Header.To - The SIP To header for the incoming request.
req.Header.To.ToURI - The URI portion of the To header.
req.Header.To.ToName - The name portion of the To header.
req.Header.Contact[0] - The first Contact header in the incoming Request.
req.Header.Contact[0].ContactURI - The URI of the first Contact header.
req.Header.Contact[0].ContactName - The Name of the first Contact header.
req.Header.CSeq
req.Header.CallId
TIA!

MikeTelis
Posts: 1582
Joined: Wed Jul 30, 2008 6:48 am

Re: Inbound Dial Plan: Detect dialed destination number

Post by MikeTelis » Tue Apr 27, 2010 4:31 am

I think you actually want to know which DID the call came from. Sipsorcery offer suffix matching for this purpose. For example, you can forward call to:

12345.sipname@sipsorcery.com

and the call still be forwarded to your sipname; in the dialplan, extract the prefix (12345) from req.URI.User. If you register to receive incoming calls, add prefix to Register Contact.

marcjohnson
Posts: 7
Joined: Fri Apr 23, 2010 4:14 pm

Re: Inbound Dial Plan: Detect dialed destination number

Post by marcjohnson » Tue Apr 27, 2010 5:25 am

Thanks.
Is this information there by default?
Or do I hear you saying that someone has to prepend a prefix to the SIP in order for me to extract it from req.URI.User?
Because I'm looking at req.URI.User during inbound, and it just has the SIP... I'm not seeing a prefix containing the number.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Inbound Dial Plan: Detect dialed destination number

Post by Aaron » Tue Apr 27, 2010 10:34 am

It sounds like you are looking to know what PSTN number was dialled at one of your providers based on a SIP call that's arrived at sipsorcery. The short answer is that unless your SIP provider has added a custom SIP header with that information for you then you can't.

One way to solve the problem would be to create individual SIP accounts for each provider and/or PSTN number you are using and use that as the SIP URI to forward calls to sipsorcery. That way when you receive a call you can check the req.URI.User and match it to the single PSTN number you have allocated to it.

Regards,
Aaron

User avatar
Flip
Posts: 95
Joined: Sun Aug 19, 2012 3:53 am

Re: Inbound Dial Plan: Detect dialed destination number

Post by Flip » Tue Oct 18, 2016 4:30 pm

Exactly what I just thought before searching "req.Header dialled number"...
Would have to somehow split 1 account with 5-100 DIDs and have them set to separate SIP accounts, which would require pre-processing which is useless...

Makes sense when you think about it... #xxx >> VSP >> A/C >> SIPSorcery >> Dial Plan...
Just not possible... This is such a big limitation in SIP Sorcery. . :(

Sorry for delay clicking submit. Thank you to the browser saving my POST data!
Aaron wrote:It sounds like you are looking to know what PSTN number was dialled at one of your providers based on a SIP call that's arrived at sipsorcery. The short answer is that unless your SIP provider has added a custom SIP header with that information for you then you can't.

One way to solve the problem would be to create individual SIP accounts for each provider and/or PSTN number you are using and use that as the SIP URI to forward calls to sipsorcery. That way when you receive a call you can check the req.URI.User and match it to the single PSTN number you have allocated to it.

Regards,
Aaron
ISP: Southern Phone ADSL2+ $55 Bundle. 22.4/1.2Mbps, GB Bundle [Telstra].
VSP: SIPTalk¹, Symbio² & MyNetFone³ via SIPSorcery Cloud PBX. [Warning! Avoid DIDLogic!!! Beware!!]
H/W: Asus RT-AC86U; Cisco SPA232D, 2 x SPA901's, SPA3102; Yealink SIP-T46G.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Inbound Dial Plan: Detect dialed destination number

Post by Aaron » Wed Oct 19, 2016 6:32 am

Flip wrote:Exactly what I just thought before searching "req.Header dialled number"...
Would have to somehow split 1 account with 5-100 DIDs and have them set to separate SIP accounts, which would require pre-processing which is useless...

Makes sense when you think about it... #xxx >> VSP >> A/C >> SIPSorcery >> Dial Plan...
Just not possible... This is such a big limitation in SIP Sorcery. . :(
There is no sipsorcery limitation. It'll be the same with any SIP server you forward calls to.

If the originating number or information is somewhere in the SIP headers then the sipsorcery header can use it. If the information is not there, as in this case, customising the destination SIP URL is one way to deal with it.

Post Reply