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

John Kiniston johnkiniston at gmail.com
Mon Apr 13 11:24:35 CDT 2015

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

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} -
same => n,Playtones(busy)
same => n,Busy(8)
same => n,Hangup()

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

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)

exten =>
same  =>                       n,Goto(trunk1-out,${EXTEN},1)

Then your internal phone context would include the above contexts:

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 at gmail.com> wrote:

> vici:~ # asterisk -rx "sip show peers"
> Name/username             Host Dyn Forcerport ACL Port     Status
> 300/300                   (Unspecified) D   N             0        UNKNOWN
> 301/301          D   N             5060     OK (29
> ms)
> 302/302                   (Unspecified) D   N             0        UNKNOWN
> gs102/gs102               (Unspecified) D   N             0        UNKNOWN
> testcarrier/19876543210                                  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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20150413/a6c78f54/attachment.html>

More information about the asterisk-users mailing list