Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] dial out with channel variable; sub-string usage


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
hawat.thufir at gmail.com
Guest





PostPosted: Wed Apr 08, 2015 6:10 pm    Post subject: [asterisk-users] dial out with channel variable; sub-string Reply with quote

I want to do something like:


exten => _NXXXNxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _Nxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _1NXXNxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _011.,1,Dial(Dial({TOLL}/${EXTEN})
exten => _9NXXXNxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _9Nxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _91NXXNxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _9011.,1,Dial(Dial({TOLL}/${EXTEN})

(adapted from the book)


but don't know where to put those lines. I have BABY defined as channel
variable:

BABY = SIP/babytel_out

but that seems circular, somehow.


inbound calls work fine:

[inbound-calls]
exten => 16046289850,1,Dial(SIP/200)

[local_200]
exten => _9x.,1,Set(CALLERID(all)="Ali Baba" <123456789>)
exten => _9x.,1,Dial(SIP/${EXTEN:1}@babytel_out)
exten => 201,1,Dial(SIP/201)

[local_201]
exten => 200,1,Dial(SIP/200)


in local_200, that just seems suspect. Yes, dial out, but shouldn't it
be using BABY? I don't understand why it's using sub-string with the 1.



thanks,

Thufir

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
cwallace at lodgingcom...
Guest





PostPosted: Thu Apr 09, 2015 2:06 pm    Post subject: [asterisk-users] dial out with channel variable; sub-string Reply with quote

On Wed, 08 Apr 2015 16:10:30 -0700
thufir <hawat.thufir@gmail.com> wrote:

Quote:
I want to do something like:


exten => _NXXXNxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _Nxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _1NXXNxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _011.,1,Dial(Dial({TOLL}/${EXTEN})
exten => _9NXXXNxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _9Nxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _91NXXNxxxxxx,1,Dial(${BABY}/${EXTEN})
exten => _9011.,1,Dial(Dial({TOLL}/${EXTEN})

(adapted from the book)


but don't know where to put those lines. I have BABY defined as
channel variable:

BABY = SIP/babytel_out

but that seems circular, somehow.

You put them in the context for your clients... From what you show
below, I'd say they go in the "local_200" context. You can verify
this by looking in sip.conf, in the section that starts with [200],
find the line that starts with "context=". It's probably
"context=local_200". Then you put the outbound dialplan in that context
in extensions.conf. Mind you, then 200 is the only phone that can dial
out. 201 can only dial 200 and nothing else.

One suggestion... those 8 lines are redundant. The first 4 let you
dial out without the 9 in front, and the last 4 need you to dial 9 to
get out. You should probably decide which way you want to do it, and
use only 4 of the lines instead of 8. Keep it simple. Also, if you
don't use 7-digit dialing in your area, you can drop the second line
(_Nxxxxxx) and only have 3.

Mind you, even if your local area supports 7-digit dialing, I'm
guessing babytel doesn't, so it wouldn't even work like that. You
would have to add your area code (or 1 and your area code) after the
slash between ${BABY} and ${EXTEN}, just on that one line.



Quote:
inbound calls work fine:

[inbound-calls]
exten => 16046289850,1,Dial(SIP/200)

[local_200]
exten => _9x.,1,Set(CALLERID(all)="Ali Baba" <123456789>)
exten => _9x.,1,Dial(SIP/${EXTEN:1}@babytel_out)
exten => 201,1,Dial(SIP/201)

[local_201]
exten => 200,1,Dial(SIP/200)


in local_200, that just seems suspect. Yes, dial out, but shouldn't
it be using BABY? I don't understand why it's using sub-string with
the 1.

That's a different syntax for the same thing. These three lines all do
the same thing:

exten => _9x.,1,Dial(SIP/${EXTEN:1}@babytel_out)

and

exten => _9x.,1,Dial(SIP/babytel_out/${EXTEN:1})

and

exten => _9x.,1,Dial(${BABY}/${EXTEN:1})

The ${EXTEN:1} strips off the "9" at the front of EXTEN, because babytel
doesn't want to get the 9 that you dial on the phone. If you go with
dialing without the 9, you'll use ${EXTEN}, not ${EXTEN:1}.


--

C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0


--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
hawat.thufir at gmail.com
Guest





PostPosted: Sun Apr 12, 2015 7:31 pm    Post subject: [asterisk-users] dial out with channel variable; sub-string Reply with quote

On 15-04-09 12:06 PM, Chad Wallace wrote:
Quote:
Quote:
but don't know where to put those lines. I have BABY defined as
Quote:
channel variable:

BABY = SIP/babytel_out

but that seems circular, somehow.
You put them in the context for your clients... From what you show
below, I'd say they go in the "local_200" context. You can verify
this by looking in sip.conf, in the section that starts with [200],
find the line that starts with "context=". It's probably
"context=local_200". Then you put the outbound dialplan in that context
in extensions.conf. Mind you, then 200 is the only phone that can dial
out. 201 can only dial 200 and nothing else.


Wait a minute, slow down. I re-installed, same sort of problem:

vici:~ #
vici:~ # asterisk -rx "sip show peers"
Name/username Host Dyn Forcerport ACL Port Status
300/300 (Unspecified) D N 0 UNKNOWN
301/301 192.168.0.24 D N 5060 OK (29
ms)
302/302 (Unspecified) D N 0 UNKNOWN
gs102/gs102 (Unspecified) D N 0 UNKNOWN
testcarrier/19876543210 198.38.7.34
N 5065 OK (82 ms)
5 sip peers [Monitored: 2 online, 3 offline Unmonitored: 0 online, 0
offline]
vici:~ #
vici:~ # asterisk -rx "sip show peer testcarrier"


* Name : testcarrier
Secret : <Set>
MD5Secret : <Not set>
Remote Secret: <Not set>
Context : default


I simply want "all" outbound calls to go through a specific context, I
think, if I understand how the channel passes control to the correct
context. I want, or need, an "outbound" context?

I know that the text has an example of ServerA routing through serverB.
Simply add a line, like:


exten => _9x.,1,Dial(SIP/${EXTEN:1}@babytel_out)

or


exten => _9x.,1,Dial(${BABY}/${EXTEN:1})

Which just brings me back to...the context for BABY...is...? BABY is a
channel variable. In the above CLI output, the channel variable is
testcarrier, which has a context of "default".

Each channel variable maps to at most one context? Many channel
variables can map to a single context?



thanks,

Thufir


--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
johnkiniston at gmail.com
Guest





PostPosted: Mon Apr 13, 2015 11:24 am    Post subject: [asterisk-users] dial out with channel variable; sub-string Reply with quote

BABY appears to be a global variable in your example.


In your CLI output testcarrier is a peer, It's not a variable at all.


The context field for your peer testcarrier is where incoming calls from testcarrirer will be routed to.


Here is some example dialplan showing how you can use one context 'trunk1-out' to dial out through your trunk


[trunk1-out]
exten => _[0-9a-zA-Z].,1,Verbose(Dialing out TRUNK1)
same => n,Set(CHANNEL(amaflags)=BILLING)
same => n,Dial(PJSIP/${EXTEN}@trunk1,60,o)
same => n,Log(ERROR,Dial to ${EXTEN} ended - DIALSTATUS is ${DIALSTATUS} - HANGUPCAUSE is ${HANGUPCAUSE})
same => n,Playtones(busy)
same => n,Busy(Cool

same => n,Hangup()




[pstn-local]
exten => _976XXXX,1,Macro(fastbusy)
exten => _nxxxxxx,1,Goto(trunk1-out,${EXTEN},1)


[toll-free]
exten => _1855NXXXXXX,1,Goto(trunk1-out,${EXTEN},1)
exten => _1866NXXXXXX,1,Goto(trunk1-out,${EXTEN},1)
exten => _1877NXXXXXX,1,Goto(trunk1-out,${EXTEN},1)
exten => _1888NXXXXXX,1,Goto(trunk1-out,${EXTEN},1)
exten => _1800NXXXXXX,1,Goto(trunk1-out,${EXTEN},1)


[long-distance]
exten => _1NXXNXXXXXX,1,Authenticate(/etc/asterisk//ldcodes.txt,a,KINISTON-001-)
same  =>                       n,Goto(trunk1-out,${EXTEN},1)



Then your internal phone context would include the above contexts:


[internal-phones]

include => pstn-local

include => toll-free

include => long-distance


Does that help make it clearer Thufir?











On Sun, Apr 12, 2015 at 5:31 PM, thufir <hawat.thufir@gmail.com (hawat.thufir@gmail.com)> wrote:
Quote:

vici:~ # asterisk -rx "sip show peers"
Name/username             Host Dyn Forcerport ACL Port     Status
300/300                   (Unspecified) D   N             0        UNKNOWN
301/301                   192.168.0.24 D   N             5060     OK (29 ms)
302/302                   (Unspecified) D   N             0        UNKNOWN
gs102/gs102               (Unspecified) D   N             0        UNKNOWN
testcarrier/19876543210 198.38.7.34                                  N             5065 OK (82 ms)
5 sip peers [Monitored: 2 online, 3 offline Unmonitored: 0 online, 0 offline]
vici:~ #
vici:~ # asterisk -rx "sip show peer testcarrier"

  * Name       : testcarrier
  Secret       : <Set>
  MD5Secret    : <Not set>
  Remote Secret: <Not set>
  Context      : default

Which just brings me back to...the context for BABY...is...?  BABY is a channel variable.  In the above CLI output, the channel variable is testcarrier, which has a context of "default".

Each channel variable maps to at most one context?  Many channel variables can map to a single context?




A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.
---Heinlein
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services