?
Solved

DNIS changing

Posted on 2007-10-09
7
Medium Priority
?
1,884 Views
Last Modified: 2013-12-21
Hi,

I have registered my Asterisk server to a sip provider and can reach my soft phone from the public telephone network by calling numbers that I have bought. I would now need to get the DNIS number (B-number) from the call to my soft phone so I know how I should answer the call (I have several incoming numbers and they should be answered differently). If I turn on "sip debug" in Asterisk I can see the DNIS in the "To:"-field in the sip header when the call comes in (<sip:"dnis-number"@"sip-provider-ip">). A few "sip conversations" later the "To:"-field changes to my soft phones local number (<sip:200@192.168.1.100:5060>).
Can I somehow get the original DNIS into a variable or is there some other way to change the sip header?

Regards,
strobe0
0
Comment
Question by:strobe0
  • 3
  • 3
7 Comments
 
LVL 36

Expert Comment

by:grblades
ID: 20046944
Normally the DNIS is mapped directly to the extension in asterisk. In your sip.conf you have a context defined for the provider. As an example lets say it is from-provider.

Now in extensions.conf you probably have an entry like :-

[from-provider]
exten => s,1,Dial(sip/myphone)

All you need to do is change it to reference the DNIS number. If your DNIS numbers are 1111, 2222 and 3333 you would have :-

[from-provider]
exten => 1111,1,Dial(sip/myphone1)
exten => 2222,1,Dial(sip/myphone2)
exten => 3333,1,Dial(sip/myphone3)
0
 

Author Comment

by:strobe0
ID: 20047028
Ok, at the moment I´m creating an internal number when I´m registering with my sip provider. That maybe the wrong way to do it...
I´m sending the incoming calls to queues. How can I get the DNIS 1111 from the line exten => 1111,1,Dial(sip/myphone1) to the client (soft phone)?
0
 
LVL 36

Accepted Solution

by:
grblades earned 2000 total points
ID: 20047043
The variable ${EXTEN} contains the dialed number aswell.

> How can I get the DNIS 1111 from the line exten => 1111,1,Dial(sip/myphone1) to the client (soft phone)?
I dont quite understand the question. What exactly do you wish to do?
0
[Video] Create a Disruption-Free Workspace

Open offices have their challenges. And Sometimes, it's even hard to work at work. It's time to reclaim your office and create a disruption-free workspace. With the MB 660, you can:

-Increase Concentration
-Improve well-being
-Boost Productivity

 

Author Comment

by:strobe0
ID: 20060160
grblades:

After som testing I found out that this didn´t work for me. Could you please provide some more help even if I already accepted your solution?

When I change extensions.conf to look like this:
exten => 358xxxxxxx,1,Dial(IAX2/400)       //The x´s are real numbers, I just masked them :)

I get the following error message when I call 358xxxxxxx number:

[Oct 11 22:09:09] NOTICE[2013]: chan_sip.c:13664 handle_request_invite: Call from '358xxxxxxx' to extension 's' rejected because extension not found.
0
 
LVL 36

Expert Comment

by:grblades
ID: 20060498
Try adding this as a test. Next run 'asterisk -r -vvv' and monitor the output as you make a call in. You should see the NoOp command appear with the extension that it was given specified. This is the number you need to put in as the proper extension in the dialplan. Sometimes you are given the full number including country code, sometimes just the local number etc... so doing this you can see exactly what format you are being given the called number in.

exten => s,1,NoOp(${EXTEN})
exten => s,n,Hangup
0
 

Author Comment

by:strobe0
ID: 20060500
Ok, I just solved it :)

I had to put an extension at the end of the register-"option" in sip.conf and then use that one in extensions.conf to match it.
Like this in sip.conf: register => 358xxxxxxx:password@sip-provider-host/358xxxxxxx
Like this in extensions.conf: exten => 358xxxxxxx,1,Dial(IAX2/400).
0
 
LVL 4

Expert Comment

by:MrYowler
ID: 20860589
Just a quick thought, but you can also establish separate contexts for each incoming line, by adding something like this in sip.conf:

[358xxxxxxx]
.
.
.
context=358xxxxxxx-inbound
.
.
.

This directs inbound calls for this line to the [358xxxxxxx-inbound] context block in your extensions.conf file.  A lot of people seem to think that all inbound traffic has start in a context like [incoming] or [sip], but you can use any context you want, each complete with their own extensions, by simply defining it correctly in sip.conf.

I'm a little late on the draw, here, but I hope it helps somebody...  :)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are no good configuration guides for HP-H3C router to LYNC on the web. :( Big statement, but we havent been able to find one yet. We did find the following document useful, but the information was not enough to use H3C router for use as a L…
Implementing Avaya's One-X portal is pretty painless, until you want to deploy this to the Android and iPhone clients when these clients are outside of your network. The clients will also work within your local network. Here is our experience and so…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question