DID Forward/ DID Passthrough

mcamino
Posts: 13
Member Since:
2007-05-12

Hello,
I have a question. This is my setup.

My VSP provides me 10 DID'S. I have 2 asterisk servers. 1 connects to my VSP via SIP and manages 90% of my normal functions (IVR, VOICEMAIL, ETC) my 2nd box is behind a firewall and is used for my sales office voip phones. They all connect to it, and it forwards the calls via a IAX Extension to my main box. Let me reexplain that in case anyone is curious, I have a outbound trunk on my sales office asterisk box which connects to my main server as an extension. (My main server thinks the second asterisk box is extension IAX 300)

Upto now, i only needed 1 DID to be forwarded to the sales office, so we set it up to ring extension 300, which would ring the sales office inward trunk and goto a ring group.

So now here is my issue/need. If i have to scrap my entire config I am willing to do it to make this work. I need 3 DIDs to goto my sales office.

The problem is since my main box thinks my second box is a phone it does not forward DID information to it. So is there a way to send DID info to an "extension" along with caller id info??? If the answer to that question is no, how do we forward DID info between boxes??



ethans
Posts: 519
Member Since:
2007-01-16
Assuming IAX between

Assuming IAX between locations:

Box1: DIDs coming into this box
Box2: Box you want to forward the DIDs to

Setup Inbound route on Box1 to point to custom destination custom-xxxxxxx,s,1 where xxxxxxx is the DID. In /etc/asterisk/extensions_custom.conf create contexts for each DID like this:

[custom-xxxxxxx]
exten => s,1,Dial(IAX2/user:pass@ip/xxxxxxx,30,r);

replace xxxxxxx with each DID and replace user, pass and ip with settings from your IAX trunks.

Setup inbound route on Box2 as a normal DID for each xxxxxxx and route wherever you want. If you had a lot of DIDs, you could make it cleaner by handling them all in one context, but above is quick and dirty.



ethans
Posts: 519
Member Since:
2007-01-16
Ok, I couldn't live with

Ok, I couldn't live with myself for not making this better:

Instead point Box1 inbound routes to custom-did-forward,xxxxxxx,1. Replace xxxxxxx with the DID.

Create one context in extensions_custom.conf:

[custom-did-forward]
exten => _X.,1,Dial(IAX2/user:pass@ip/${EXTEN},30,r);



mcamino
Posts: 13
Member Since:
2007-05-12
Okay. I think i got a pretty

Okay. I think i got a pretty good idea what you are asking but I think i am missing a few steps somehow.

Okay so i went into my extensions_custom.conf file and added

[custom-did-forward]
exten => _X.,1,Dial(IAX2/300:xxxxxxxx@sip2.camino-net.com/${EXTEN},30,r);

Hit update and reread configs. I then clicked on Inbound routes in my freepbx panel (trixbox panel) and clicked on my DID i had already setup. But i do not see where i can click on or type that custom context to forward to??

Sorry about stupid questions.



mcamino
Posts: 13
Member Since:
2007-05-12
Nevermind I figured 3/4 of it out....

Okay i googled and found the answer how to add custom destinations.. i got that to work, so now i am 75% there... I tried it and i got an error. below is asterisk log.. any clue what i can do it resolve it or troubleshoot it better?

May 27 22:18:05 VERBOSE[2454] logger.c: -- Format for call is ulaw
May 27 22:18:05 VERBOSE[300] logger.c: -- Executing Set("IAX2/300-8", "FROM_DID=2155253193") in new stack
May 27 22:18:05 VERBOSE[300] logger.c: -- Executing Goto("IAX2/300-8", "s|1") in new stack
May 27 22:18:05 VERBOSE[300] logger.c: -- Goto (from-trunk,s,1)
May 27 22:18:05 VERBOSE[300] logger.c: -- Executing Dial("IAX2/300-8", "IAX2/300­ /2155253193") in new stack
May 27 22:18:05 WARNING[300] chan_iax2.c: No such host: 300­
May 27 22:18:05 NOTICE[300] app_dial.c: Unable to create channel of type 'IAX2' (cause 3 - No route to destination)
May 27 22:18:05 VERBOSE[300] logger.c: == Everyone is busy/congested at this time (1:0/0/1)
May 27 22:18:05 DEBUG[300] app_dial.c: Exiting with DIALSTATUS=CHANUNAVAIL.
May 27 22:18:05 VERBOSE[300] logger.c: -- Executing Hangup("IAX2/300-8", "") in new stack



ethans
Posts: 519
Member Since:
2007-01-16
Can you call between

Can you call between locations over the IAX trunk? Try an IP instead of hostname. What are you trunk settings for each location?



mcamino
Posts: 13
Member Since:
2007-05-12
Okay i changed

Okay i changed sip2.camino-net.com to the actual ip address and got a different error message. So this is my current extensions_custom.conf

[custom-did-forward]
exten => _X.,1,Dial(IAX2/300:xxxxxx@68.80.146.xxx/${EXTEN},30,r);

here is my iax_additional

[300]
type=friend
setvar=REALCALLERIDNUM=300
secret=xxxxxxxxxxxxxxx
record_out=Always
record_in=Always
qualify=yes
port=4569
notransfer=yes
mailbox=300@default
host=dynamic
disallow=
dial=IAX2/300
context=from-trunk
callerid=device
allow=
accountcode=

Yes the IAX extension seems to work. Currently 1 i have 2 inbound routes. 1 is 2155253192 which is the old original one. I just called it and 20 phones began to ring. the second one, i am testing with is 2155253193. On my Main 1 server i setup a custom destination :custom-did-forward,2155253193,1

I then made the inward route from the DID use that custom destination and sure enough we are making progress. It now goes to my 2nd server. Which is rejecting the connection. This is the log snip from second server

May 27 22:41:34 DEBUG[13956] manager.c: Manager received command 'Command'
May 27 22:41:34 DEBUG[13956] manager.c: Manager received command 'Command'
May 27 22:41:34 DEBUG[13956] manager.c: Manager received command 'Command'
May 27 22:41:42 NOTICE[2786] chan_iax2.c: Rejected connect attempt from 74.92.96.19, who was trying to reach '2155253193@'

I am googling as we speak to see what the message means and if there is a easy solution for it. Do you have any suggestions.

By the way, i appreciate your help, you are a great asset to the OSS community.



ethans
Posts: 519
Member Since:
2007-01-16
Ok, so we generally setup a

Ok, so we generally setup a separate trunk for DID forwarding with the following parameters:

Box2 (receiving end):
Incoming Settings:

User Context: User

User Details:
username=User
type=friend
secret=Password
mailboxdetail=yes
host=IP_of_remote
context=from-pstn
allow=all

Then all of your Dial()'s in extensions_custom.conf reference these settings. You could interchange with context=from-trunk because that's just an alias of from-pstn for clarity on IP channels.

Every time I work with IAX trunks my brain gets foggy, which means I need to think more about what I am doing rather than copying and pasting things from years ago...



mcamino
Posts: 13
Member Since:
2007-05-12
Yupp

Okay that final piece of advice was the final piece of the puzzle and it is now working perfectly. The only thing which is outstanding is why i must use the ip address instead of hostname but i am sure that is a topic for another thread. Great job!!!



voxter
Posts: 50
Member Since:
2007-11-20
Quick followup on this.. I

Quick followup on this..

I have about 100 DIDs i need to do this for. Creating two separate entries, one in Inbound Routes, and another Custom Destination for every DID i want to forward is rather cumbersome to set up, and definitely a pain to maintain!

I've simplified this even further:

In extensions_custom.conf you can still use what Ethan originally suggested. Depending on how your IAX trunks are set up, you dont even really need to use the user:pass@ip part, you can just use IAX2/peername/${EXTEN} - but for the sake of being verbose, lets stick with the original way for now..

[custom-did-forward]
exten => _X.,1,Dial(IAX2/user:pass@ip/${EXTEN},30,r)

Then, when making a Custom Destination, set it up like so:

Custom Destination: custom-did-forward,${EXTEN},1

This way, when creating Misc Applications -- or in most peoples cases, Inbound Routes, it will simply pass on the DID that was originally requested to the destination server.

So if i set up an inbound route for 6041234567, I point at the "DID Forwarding" custom destination I've created, and it dials 6041234567 on the destination server. One simple Custom Destination, and inbound routes are still the only spot to maintain DIDs you want to be forwarded!



SkykingOH
Posts: 9675
Member Since:
2007-12-17
With the new dialplan

With the new dialplan injection module this would be very simple.

--

Scott

aka "Skyking"



djyvr8
Posts: 76
Member Since:
2007-02-01
Just out of curiosity...

How would one use the new dialplan injection module to do this? I would really like to use this module as it looks very powerful.

Thanks,
dj



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.