Page 1 of 1

Inbound Dial Plan: Detect dialed destination number

Posted: Tue Apr 27, 2010 3:32 am
by marcjohnson
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!

Re: Inbound Dial Plan: Detect dialed destination number

Posted: Tue Apr 27, 2010 4:31 am
by MikeTelis
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.

Re: Inbound Dial Plan: Detect dialed destination number

Posted: Tue Apr 27, 2010 5:25 am
by marcjohnson
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.

Re: Inbound Dial Plan: Detect dialed destination number

Posted: Tue Apr 27, 2010 10:34 am
by Aaron
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

Re: Inbound Dial Plan: Detect dialed destination number

Posted: Tue Oct 18, 2016 4:30 pm
by Flip
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

Re: Inbound Dial Plan: Detect dialed destination number

Posted: Wed Oct 19, 2016 6:32 am
by Aaron
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.