?
Solved

Asterisk utterly confused over 2 IAX trunks?

Posted on 2006-04-29
21
Medium Priority
?
551 Views
Last Modified: 2007-12-19
Hi all…

Well, after 6-hours and no luck, figured it was time to turn here.  This in on asterisk@home 1.2.6.   The problem is pretty simple.  As you’ll observe below, I have two trunks from the same provider.  Ones my regular number and the other an 888 toll free number.  

The problem is, now that I’ve added the 888 trunk, Asterisk “WILL NOT” stop processing after hitting the first context.  It continues onto the 888 context, which results in ALL inbound calls claiming to originate from the 888 number.  This appears in both the CLI and the log files. In other words, call the 3125551212 number and all you see is IAX2/8885551212 scrolling down the CLI.  I should only be seeing this IF I call my 888 number.

 So what’re really happening?  Have a look at this small snippet showing the first 2 lines of the inbound process.  In this case, I called the 312 number:

-- Executing Set("IAX2/8885551212", "FROM_DID=3125551212") in new stack
-- Executing Set("IAX2/8885551212", "FAX_RX=disabled") in new stack
-- A million more lines with IAX2/8885551212 showing as the dialed number...

So Wtf?  If 3125551212 was dialed, then what’s 8885551212 doing in here?   It seems Asterisk is utterly confused.  

Here’s my Iax.conf:


register=3125551212:12345@iax01.unlimitel.com

[3125551212]
username=3125551212
type=friend
secret=12345
host=iax01.unlimitel.com
disallow=all
context=from-pstn
allow=ulaw


[unlimitel-in]
type=friend
disallow=all
context=from-pstn
allow=ulaw


[8885551212]
username=8885551212
type=friend
secret=123456
host=iax01.unlimitel.com
disallow=all
context=from-pstn
allow=ulaw

[unlimitel-in1]
type=friend
disallow=all
context=from-pstn
allow=ulaw
register=8885551212:123456@iax01.unlimitel.com

What we need is some way to tell Asterisk to HALT processing once we’ve found a *Match*  Does anyone know how to do this?  I know how to do it Perl or even Procmail, but this?  

I've tried endless experments with placing the above in different order --even placing the 888 number in an #include of its own, but no luck.

Any insight would be greatly appreciated,

D.
0
Comment
Question by:dholingw
  • 12
  • 9
21 Comments
 
LVL 36

Expert Comment

by:grblades
ID: 16571878
Currently your 888 number is in the same from-pstn context as your other number and this means you cannot easily diferentiate between the two calls. I would suggest changing the context to something like from-888.

You will also need to change the extensions.conf after making this change aswell. As you are using @home I would try making these changes through the web interface as the configuration it creates is very messy and nasty to change manually.
0
 

Author Comment

by:dholingw
ID: 16572526
>>> Currently your 888 number is in the same from-pstn context as your other number and this means you cannot easily diferentiate between the two calls. I would suggest changing the context to something like from-888.

You’ve lost me..  What am I supposed to change to 888?  That from-pstn thing is in both of them.  Maybe correctly understanding your syntactical terms is part of problem of my problem here.  Are you referring to this:  

[8885551212]
username=8885551212
blah=blah

I changed this to gazillions of different names

[tollfree888]
username=8885551212
blah=blah

[bahbahbooey888]
username=8885551212
blah=blah

Is this what you mean?  If so, it was already tried and didn’t change anything.  Asterisk still insists on grabbing the name of the second truck (no matter what it is) and displaying it as the ‘called did.’  

>>>You will also need to change the extensions.conf after making this change aswell. As you are using @home I would try making these changes through the web interface as the configuration it creates is very messy and nasty to change manually.


Perhaps when I understand the first part of your instructions, this one will come easier.  As for doing it through the interface, you know what?  I’m starting to hate that dam interface.  It’s too restrictive, and in most cases, you really don’t know what it’s written to a file.  Almost reminds me of what web panels like Plesk and C-panel did to our server operating system.

ANYWAY…..  More and more, I’m allowing AMP to create a template.  For example, my iax configurations, which I’ll dump it into iax.conf.  Now I can customize them and they’ll never be touched by AMP again.  This is becasue AMP only writes to iax_additional.conf –not iax.conf.  You can do this with most all files you want to take control over in the /etc/asterisk directory.  

D.





 
0
 

Author Comment

by:dholingw
ID: 16572559
Ahh.. I think I get it.  You mean change one of the from-pstn names. But how would you change this through the interface?  I have no idea what controls the from-pstn thing, or how to add another one.  This is where it becomes confusing:

Have a look at the top of extensions.conf:


[from-trunk]                                          ; just an alias since VoIP shouldn't be called PSTN
include => from-pstn

[from-pstn]
include => from-pstn-custom                     ; create this context in extensions_custom.conf to include customizations
include => ext-did
exten => fax,1,Goto(ext-fax,in_fax,1)


Well... When you see include => from-pstn, you assume there to be a file with this name in /etc/asterisk, right?  After all, that's what an include is --a custom file of sorts.  But alas, there's no such filename in the directory, so it just futher confuses you.  The from-pstn is located somewhere, and if I had a better idea of how it worked, or what the include was ACTUALLY reffering to, I could play around with it.  Just a very confusing program to work with :-)

D


0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 36

Expert Comment

by:grblades
ID: 16572830
Change :-
[8885551212]
context=from-pstn
to :-
[8885551212]
context=from-888

Now when a call comes in from that number it comes into the from-888 context defined in your extensions.conf file.

In extensions.conf you have :-
[from-pstn]
include => from-pstn-custom                     ; create this context in extensions_custom.conf to include customizations
include => ext-did
The two include lines will include the two other contexts ([fron-pstn-costom] and [ext-did] sections within extensions.conf) as if they were local.
0
 
LVL 36

Expert Comment

by:grblades
ID: 16572843
Are the passwords used for the IAX connections (secret=) different?
0
 

Author Comment

by:dholingw
ID: 16572894
Update…

Things are becoming a real mess here.  I’ve decided to forgo the iax.conf method for now, and have placed all trunk management back into AMP.  So as of now, all trunks are being managed by AMP.   I have yet to make sense of the ‘from-pstn’ thing, as it’s poorly documented, so figuring out what this does, or how to create another one is all but impossible.  It’s ‘assumed’ by the developers you know what all this stuff does and how to create additional ones I guess.  

Thx,

D.  
0
 

Author Comment

by:dholingw
ID: 16572900
Ooops... Posting collision!  

I think we posted at almost the same time.  I'll read through your message.

D.  
0
 

Author Comment

by:dholingw
ID: 16572913
>Are the passwords used for the IAX connections (secret=) different?

That would be a yes.  

I dunna know... It seems asterisk  refuses to stop when it's found a matching inbound DID.  It wants to keep going anyway to the last trunk in the list.  All of the trouble seems to be stopping it from continuing to:

[tollfree888]

Or... Whatever you last trunck name is.  How wonke is this, huh?  :-)

Thanks again,

D.
0
 
LVL 36

Expert Comment

by:grblades
ID: 16572974
> I dunna know... It seems asterisk  refuses to stop when it's found a matching inbound DID
Thats not the way it works. When a comnnection comes in it looks through all the [xxx] sections within iax.conf until it finds a match for the username/password which was sent. For more details on this see http://www.voip-info.org/wiki/view/Asterisk+IAX+authentication
Then when it finds a match it jumps to the section in extensions.conf which matches the contect specified in the iaax.conf section (from-pstn in this case).

What appears to be happening in your case is when someone calls in on the 3125551212 number the call is somehow matching the [8885551212] section. To complicate matters even more unlimitel can give you a normal and 888 number as an IAX trunk and this may be what is happening here. Their support is supposed to be good so I would suggest contacting them and ask then to check you iax.conf.
0
 

Author Comment

by:dholingw
ID: 16573000
Change :-
[8885551212]
context=from-pstn
to :-
[8885551212]
context=from-888

Let’s confirm the instructions…

You’re speaking of the ‘Trunk Name” in “Outgoing Settings” correct?   In the context box, change context=from-pstn, to context=from-888, correct?   Don’t change anything in the “incoming settings” box, correct?

Am I close here, or way off base?   I did exactly that, but the results are still the same.  Call the 3125551212 DID, and 8885551212 continues to display in the CLI.   I also tried the dialing the actual  8885551212 number, but these changes have stopped it from working.  

Man… Where am I going wrong here?  Time to take a deep breath and chill for a bit.  

D.
0
 
LVL 36

Expert Comment

by:grblades
ID: 16573040
Sorry I cant guide you through the web interface as I have never used it.

Firstly you need to find out whether unlimitel are actually sending the calls over a single trunk. If they are then all the calls will appear to come from a single IAX section.

> -- Executing Set("IAX2/8885551212", "FROM_DID=3125551212") in new stack
All this means is that the incoming call matched the [8885551212] section within iax/conf.


Put the configuration back to the way it was so that both numbers are working.
Then post the output which is shown when you dial both of the numbers.
0
 

Author Comment

by:dholingw
ID: 16574317
>>Sorry I cant guide you through the web interface as I have never used it.

   If the only way to do it is by manually editing text files, then so be it... We'll do it manually. Besides, there's not a whole lot you can do in the interface as far as this problem goes.  Here's the output you requested in two big sloppy chunks :-)


 Ok…  Here’s the trunks that appeared as registered:

Registered IAX2 to '64.36.157.233', who sees us as 206.258.140.216:4569 with no messages waiting
Registered IAX2 to '64.36.157.233', who sees us as 206.258.140.216:4569 with no messages waiting


Here’s what the console displays when calling 3125551212:

-- Accepting AUTHENTICATED call from 64.36.157.233:
       > requested format = ulaw,
       > requested prefs = (ulaw|gsm),
       > actual format = ulaw,
       > host prefs = (ulaw),
       > priority = mine
    -- Executing Set("IAX2/8885551212-5", "FROM_DID=3125551212") in new stack
    -- Executing Set("IAX2/8885551212-5", "FAX_RX=disabled") in new stack
    -- Executing Goto("IAX2/8885551212-5", "custom-myapp|s|1") in new stack
    -- Goto (custom-myapp,s,1)
    -- Executing Answer("IAX2/8885551212-5", "") in new stack
    -- Executing Wait("IAX2/8885551212-5", "1") in new stack
    -- Executing Goto("IAX2/8885551212-5", "telemarketer-custom|s|1") in new stack
    -- Goto (telemarketer-custom,s,1)
    -- Executing GotoIf("IAX2/8885551212-5", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-5", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-5", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-5", "0?continue-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-5", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-5", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-5", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-5", "0?bypass-custom|s|1") in new stack
    -- Executing Goto("IAX2/8885551212-5", "filter-custom|s|1") in new stack
    -- Goto (filter-custom,s,1)
    -- Executing Zapateller("IAX2/8885551212-5", "answer|nocallerid") in new stack
    -- Executing Wait("IAX2/8885551212-5", "1") in new stack
    -- Executing LookupBlacklist("IAX2/8885551212-5", "") in new stack
    -- Executing SetMusicOnHold("IAX2/8885551212-5", "default") in new stack
    -- Executing GotoIf("IAX2/8885551212-5", "0?who-r-u|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-5", "0?who-r-u|s|1") in new stack
    -- Executing Goto("IAX2/8885551212-5", "main_1|s|1") in new stack
    -- Goto (main_1,s,1)
    -- Executing GotoIf("IAX2/8885551212-5", "0?4") in new stack
    -- Executing Answer("IAX2/8885551212-5", "") in new stack
    -- Executing Wait("IAX2/8885551212-5", "1") in new stack
    -- Executing SetVar("IAX2/8885551212-5", "DIR-CONTEXT=general") in new stack
    -- Executing DigitTimeout("IAX2/8885551212-5", "3") in new stack
    -- Set Digit Timeout to 3
    -- Executing ResponseTimeout("IAX2/8885551212-5", "7") in new stack
    -- Set Response Timeout to 7
    -- Executing BackGround("IAX2/8885551212-5", "custom/incomming") in new stack
    -- Playing 'custom/incomming' (language 'en')
  == Spawn extension (main_1, s, 7) exited non-zero on 'IAX2/8885551212-5'
    -- Executing Hangup("IAX2/8885551212-5", "") in new stack
  == Spawn extension (main_1, h, 1) exited non-zero on 'IAX2/8885551212-5'
n      Hungup 'IAX2/8885551212-5'





Now calling Asterisk on: 8885551212


-- Accepting AUTHENTICATED call from 64.36.157.233:
       > requested format = ulaw,
       > requested prefs = (ulaw|gsm),
       > actual format = ulaw,
       > host prefs = (ulaw),
       > priority = mine
    -- Executing Set("IAX2/8885551212-2", "FROM_DID=8885551212") in new stack
    -- Executing Set("IAX2/8885551212-2", "FAX_RX=disabled") in new stack
    -- Executing Goto("IAX2/8885551212-2", "custom-myapp|s|1") in new stack
    -- Goto (custom-myapp,s,1)
    -- Executing Answer("IAX2/8885551212-2", "") in new stack
    -- Executing Wait("IAX2/8885551212-2", "1") in new stack
    -- Executing Goto("IAX2/8885551212-2", "telemarketer-custom|s|1") in new stack
    -- Goto (telemarketer-custom,s,1)
    -- Executing GotoIf("IAX2/8885551212-2", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-2", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-2", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-2", "0?continue-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-2", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-2", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-2", "0?bypass-custom|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-2", "0?bypass-custom|s|1") in new stack
    -- Executing Goto("IAX2/8885551212-2", "filter-custom|s|1") in new stack
    -- Goto (filter-custom,s,1)
    -- Executing Zapateller("IAX2/8885551212-2", "answer|nocallerid") in new stack
    -- Executing Wait("IAX2/8885551212-2", "1") in new stack
    -- Executing LookupBlacklist("IAX2/8885551212-2", "") in new stack
    -- Executing SetMusicOnHold("IAX2/8885551212-2", "default") in new stack
    -- Executing GotoIf("IAX2/8885551212-2", "0?who-r-u|s|1") in new stack
    -- Executing GotoIf("IAX2/8885551212-2", "0?who-r-u|s|1") in new stack
    -- Executing Goto("IAX2/8885551212-2", "main_1|s|1") in new stack
    -- Goto (main_1,s,1)
    -- Executing GotoIf("IAX2/8885551212-2", "0?4") in new stack
    -- Executing Answer("IAX2/8885551212-2", "") in new stack
    -- Executing Wait("IAX2/8885551212-2", "1") in new stack
    -- Executing SetVar("IAX2/8885551212-2", "DIR-CONTEXT=general") in new stack
    -- Executing DigitTimeout("IAX2/8885551212-2", "3") in new stack
    -- Set Digit Timeout to 3
    -- Executing ResponseTimeout("IAX2/8885551212-2", "7") in new stack
    -- Set Response Timeout to 7
    -- Executing BackGround("IAX2/8885551212-2", "custom/incomming") in new stack
    -- Playing 'custom/incomming' (language 'en')
  == Spawn extension (main_1, s, 7) exited non-zero on 'IAX2/8885551212-2'
    -- Executing Hangup("IAX2/8885551212-2", "") in new stack
  == Spawn extension (main_1, h, 1) exited non-zero on 'IAX2/8885551212-2'
n      Hungup 'IAX2/8885551212-2'


Does this help?


Much thanks as always,

 Dave
 
0
 
LVL 36

Expert Comment

by:grblades
ID: 16576188
It looks fine to me. Remember all that IAX2/8885551212 means is that the call matched the [8885551212] section in iax.conf for authentication purposes. I dont know why both calls are matching the same entry but I suspect that unlimitel are sending the calls over a single IAX trunk which is the most efficient method.

Early on you can see that FROM_DID is being set correctly. DID stands for Direct Inward Dial and so basically this variable contains the number the inbound caller dialed.

What is the problem you are actually having?
Do you need it to do something different depending on which number is called?
0
 

Author Comment

by:dholingw
ID: 16578240
Well..  It makes a real mess of the call reports.  I can’t tell what came from the toll free number, and what did not.  This is starting to look more like a provider issue, than that of Asterisk, but the questions is… How do I actually argue this to the provider?   Are we assuming they’re sending over a single truck, or do we have enough evidence to actually make this claim?  It’s a shame that something so simple has became this much of  a headache and even more aggravating to consider the possibility of this fiasco could be caused by some dumb ass config the providers using.  

I mean... This is totally gay.  If I use several trunks from them, inbound call reports will be a completly unusable, unless you want to trace all of them back to the originating DID. Man... That's BRUTAL.

D.
0
 
LVL 36

Expert Comment

by:grblades
ID: 16578557
They are doing nothing wrong. You cannot look at the IAX2/xxxx part of the source to find the number it came in on. For example if you were using a PRI standard telco line this would just show the particular channel the call came in on. You always have to look at the DID value to find the dialed number for incoming calls.
0
 

Author Comment

by:dholingw
ID: 16578751
So… That means inbound reports of the originating DID will be somewhat ambiguous, and ability to point the toll free number to a (separate auto attendant or include) would be almost impossible, since things are not "Always As They Appear" in Asterisk :-)

 I wanted to have the 888 number pointing to Auto Attendant 4.  Of course, for this to happen, Asterisk needs to correctly match an 888 inbound call.  Is there a way to do this in  extensions_custom.conf?  I understand how    {CALLERIDNAME) and {CALLERIDNUM) works, but that’s for the CLID of the inbound caller -not the trunk.  

Is there an example of what you’d use match an inbound DID number?  If I could at least get this to work, I’d be happy.  

Thanks,

D.
0
 
LVL 36

Accepted Solution

by:
grblades earned 2000 total points
ID: 16579018
The first line sets the DID variable :-
-- Executing Set("IAX2/8885551212-2", "FROM_DID=8885551212") in new stack
So you could have something like
GotoIf($["${FROM_DID}" = "8885551212"]?200)
This will just continue in the dialplan if the DID was not the 888 number but if it is it will jump to step 200.

As far as the call report is concerned there are two entries which container the original caller ID and the number called. This is all the information you need to distinguish between the calls. Outgoing calls will always have one of your phones as the source and incoming will always have one of your two numbers as the destination.
0
 

Author Comment

by:dholingw
ID: 16579315
>> GotoIf($["${FROM_DID}" = "8885551212"]?200)

I’ll try that and see what happens.  Hopefully the fact that everything inbound appears as 888 will not trip it erroneously.  It ‘should’ work, since we did observe the originating DID in my other messages.  

>> As far as the call report is concerned there are two entries which container the original caller ID and the number called.

Yeah… There’s some additional funky stuff going on here.  It looks as if Unlimitel is sending the 888 traffic through a local exchange of some sort.   And inbound call from the 888 number in (Call Reports) appears as follows:

- Chanenel:IAX2/88866...
- Source: 3122725000 (Wtf... Where did this number come from?)
- Clid: 3122725000  (Wtf again...)

This only happens if the inbound call originated from the 888 DID –not my standard DID.   So… They’re trunking inbound 888 calls through a local exchange of some sort? I wonder why this fantom number dosen't show up in in the CLI -only the Call Reports.  Welcome to the increasingly complex world of telecommunications, huh? :-)

D.  
0
 

Author Comment

by:dholingw
ID: 16580350
That was sort of a silly question.  In the 888 ‘inbound routes’ screen, the ‘set destination’, pointing to a custom app will accomplish this.  My brain must be turning to mush…

Just one final question:  When you look at ‘Caller Reports’ and a custom app has been used, it displays under the ‘Dst’ column as:  s.  Obviously meaning it went to s,1 of the custom app.   Is there any way to customize this to display as something meaningful?  For example, how about having it display as ‘inbound tollfree’ instead?     Not the end of the world if it can't, but would be nice.

Thanks

D.  
0
 
LVL 36

Expert Comment

by:grblades
ID: 16580902
I dont think you can change the DST column. You can however put what you want in the accountcode and user field (dont know if these are both entered in the .csv file by default).
I normally log everything to a postgres database and then have a simple PHP script to pull the data out of the database in the format I want and save it as a csv file.
0
 

Author Comment

by:dholingw
ID: 16581108
Ok... I'll just leave it for now.  All seems to be working as I want it to.  

Thanks gr,

D.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: user_n
How Sip Phone (User Agent) works and communicates with sip servers 1.  There is a sip server and a sip registrar.  The sip server and sip registrar can be one server or two different servers. The sip registrar is the server on which it is record…
Why do some people recommend buying business VoIP from an ISP? What are the benefits to my company? What are the costs?
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses

749 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