Page 1 of 1

dialplan_entry for a carrier (outbound)

PostPosted: Fri Mar 27, 2015 1:44 pm
by THUFIR
I have a tome,
Asterisk, the Definitive Guide
, and don't mind reading it. I'll go back and review the sections on creating a dialplan. The carrier suggests breaking the entry into incoming and outgoing, so I want to go along with this suggestion.

Obviously, I don't want to be using
Code: Select all
TESTSIPTRUNK
with a real carrier, that should be
Code: Select all
BABYTEL
, of course.

instead of 1,2,3, shouldn't the lines be 1,n,n? Next?

I just want to make sure that for the outbound dial plan, the most critical portion, that's the carrier entry which the below dialpan would be associated with?


Both the inbound and outbound should have, or rather, share, the same
Code: Select all
Global String
?



The part which I particularly struggle with is:


Code: Select all
MariaDB [asterisk]>
MariaDB [asterisk]> select dialplan_entry from vicidial_server_carriers where carrier_name like 'babytel';
+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| dialplan_entry                                                                                                                                             |
+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| exten => _91999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91999NXXXXXX,2,Dial(${TESTSIPTRUNK}/${EXTEN:2},,To)
exten => _91999NXXXXXX,3,Hangup
 |
+------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

MariaDB [asterisk]>


Code: Select all
linux-k7qk*CLI>
linux-k7qk*CLI> sip show peers
Name/username             Host                                    Dyn Forcerport ACL Port     Status     
201/201                   192.168.0.15                             D   N             58792    OK (281 ms)
202/202                   192.168.0.15                             D   N             58792    OK (200 ms)
babytel/1234567890        198.38.7.34                                  N             5065     Unmonitored
gs102/gs102               (Unspecified)                            D   N             0        UNKNOWN   
4 sip peers [Monitored: 2 online, 1 offline Unmonitored: 1 online, 0 offline]
linux-k7qk*CLI>
linux-k7qk*CLI> sip show peer babytel


  * Name       : babytel
  Secret       : <Set>
  MD5Secret    : <Not set>
  Remote Secret: <Not set>
  Context      : trunkinbound
  Subscr.Cont. : <Not set>
  Language     : en
  AMA flags    : Unknown
  Netborder CPD: No
  Transfer mode: open
  CallingPres  : Presentation Allowed, Not Screened
  Callgroup    :
  Pickupgroup  :
  MOH Suggest  : default
  Mailbox      :
  VM Extension : asterisk
  LastMsgsSent : 32767/65535
  Call limit   : 0
  Max forwards : 0
  Dynamic      : No
  Callerid     : "" <>
  MaxCallBR    : 384 kbps
  Expire       : -1
  Insecure     : invite
  Force rport  : Yes
  ACL          : No
  DirectMedACL : No
  T.38 support : No
  T.38 EC mode : Unknown
  T.38 MaxDtgrm: 4294967295
  DirectMedia  : No
  PromiscRedir : No
  User=Phone   : No
  Video Support: No
  Text Support : No
  Ign SDP ver  : No
  Trust RPID   : No
  Send RPID    : Yes
  TrustIDOutbnd: Legacy
  Subscriptions: Yes
  Overlap dial : No
  Outb. proxy  : nat5.babytel.ca
  DTMFmode     : rfc2833
  Timer T1     : 500
  Timer B      : 32000
  ToHost       : nat5.babytel.ca
  Addr->IP     : 198.38.7.34:5065
  Defaddr->IP  : (null)
  Prim.Transp. : UDP
  Allowed.Trsp : UDP
  Def. Username: 1234567890
  SIP Options  : (none)
  Codecs       : 0x6 (gsm|ulaw)
  Codec Order  : (ulaw:20,gsm:20)
  Auto-Framing : No
  Status       : Unmonitored
  Useragent    :
  Reg. Contact :
  Qualify Freq : 60000 ms
  Sess-Timers  : Accept
  Sess-Refresh : uas
  Sess-Expires : 1800 secs
  Min-Sess     : 90 secs
  RTP Engine   : asterisk
  Parkinglot   :
  Use Reason   : No
  Encryption   : No

linux-k7qk*CLI>
linux-k7qk*CLI> exit
linux-k7qk:~ #
linux-k7qk:~ #


linux-k7qk:~ #
linux-k7qk:~ # cat /etc/asterisk/sip-vicidial.conf
; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST
register => 16046289850@sip.babytel.ca:4rszUyk9:16046289850@nat5.babytel.ca:5065/16046289850

; VICIDIAL Carrier: BABYTEL - babytel
; some carrier
[babytel]
type=peer
qualify=no
insecure=no
host=nat5.babytel.ca
port=5065
username=1234567890
host=nat5.babytel.ca
outboundproxy=nat5.babytel.ca:5065
secret=gdsndshdsdsjklvds54534nhjkf
canreinvite=no
insecure=invite



[201]
username=201
secret=password
accountcode=201
callerid="jitsi201" <201>
mailbox=201
context=default
type=friend
host=dynamic

[202]
username=202
secret=password
accountcode=202
callerid="jitsi202" <202>
mailbox=202
context=default
type=friend
host=dynamic

[gs102]
username=gs102
secret=EfTj2JWuQBxC33h
accountcode=gs102
callerid="Test Admin Phone" <>
mailbox=102
context=default
type=friend
host=dynamic


; END OF FILE    Last Forced System Reload: 2015-03-20 07:27:40
linux-k7qk:~ #
linux-k7qk:~ #





The full configuration:



Code: Select all
linux-k7qk*CLI>
linux-k7qk*CLI> sip show peers
Name/username             Host                                    Dyn Forcerport ACL Port     Status     
201/201                   192.168.0.15                             D   N             58792    OK (281 ms)
202/202                   192.168.0.15                             D   N             58792    OK (200 ms)
babytel/1234567890        198.38.7.34                                  N             5065     Unmonitored
gs102/gs102               (Unspecified)                            D   N             0        UNKNOWN   
4 sip peers [Monitored: 2 online, 1 offline Unmonitored: 1 online, 0 offline]
linux-k7qk*CLI>
linux-k7qk*CLI> sip show peer babytel


  * Name       : babytel
  Secret       : <Set>
  MD5Secret    : <Not set>
  Remote Secret: <Not set>
  Context      : trunkinbound
  Subscr.Cont. : <Not set>
  Language     : en
  AMA flags    : Unknown
  Netborder CPD: No
  Transfer mode: open
  CallingPres  : Presentation Allowed, Not Screened
  Callgroup    :
  Pickupgroup  :
  MOH Suggest  : default
  Mailbox      :
  VM Extension : asterisk
  LastMsgsSent : 32767/65535
  Call limit   : 0
  Max forwards : 0
  Dynamic      : No
  Callerid     : "" <>
  MaxCallBR    : 384 kbps
  Expire       : -1
  Insecure     : invite
  Force rport  : Yes
  ACL          : No
  DirectMedACL : No
  T.38 support : No
  T.38 EC mode : Unknown
  T.38 MaxDtgrm: 4294967295
  DirectMedia  : No
  PromiscRedir : No
  User=Phone   : No
  Video Support: No
  Text Support : No
  Ign SDP ver  : No
  Trust RPID   : No
  Send RPID    : Yes
  TrustIDOutbnd: Legacy
  Subscriptions: Yes
  Overlap dial : No
  Outb. proxy  : nat5.babytel.ca
  DTMFmode     : rfc2833
  Timer T1     : 500
  Timer B      : 32000
  ToHost       : nat5.babytel.ca
  Addr->IP     : 198.38.7.34:5065
  Defaddr->IP  : (null)
  Prim.Transp. : UDP
  Allowed.Trsp : UDP
  Def. Username: 1234567890
  SIP Options  : (none)
  Codecs       : 0x6 (gsm|ulaw)
  Codec Order  : (ulaw:20,gsm:20)
  Auto-Framing : No
  Status       : Unmonitored
  Useragent    :
  Reg. Contact :
  Qualify Freq : 60000 ms
  Sess-Timers  : Accept
  Sess-Refresh : uas
  Sess-Expires : 1800 secs
  Min-Sess     : 90 secs
  RTP Engine   : asterisk
  Parkinglot   :
  Use Reason   : No
  Encryption   : No

linux-k7qk*CLI>
linux-k7qk*CLI> exit
linux-k7qk:~ #
linux-k7qk:~ #


linux-k7qk:~ #
linux-k7qk:~ # cat /etc/asterisk/sip-vicidial.conf
; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST
register => 1234567890@sip.babytel.ca:gfdgfg54654gfnfgn:1234567890@nat5.babytel.ca:5065/1234567890

; VICIDIAL Carrier: BABYTEL - babytel
; some carrier
[babytel]
type=peer
qualify=no
insecure=no
host=nat5.babytel.ca
port=5065
username=1234567890
host=nat5.babytel.ca
outboundproxy=nat5.babytel.ca:5065
secret=gdsndshdsdsjklvds54534nhjkf
canreinvite=no
insecure=invite



[201]
username=201
secret=password
accountcode=201
callerid="jitsi201" <201>
mailbox=201
context=default
type=friend
host=dynamic

[202]
username=202
secret=password
accountcode=202
callerid="jitsi202" <202>
mailbox=202
context=default
type=friend
host=dynamic

[gs102]
username=gs102
secret=EfTj2JWuQBxC33h
accountcode=gs102
callerid="Test Admin Phone" <>
mailbox=102
context=default
type=friend
host=dynamic


; END OF FILE    Last Forced System Reload: 2015-03-20 07:27:40
linux-k7qk:~ #
linux-k7qk:~ #


Re: dialplan_entry for a carrier (outbound)

PostPosted: Tue Mar 31, 2015 4:38 am
by okli
instead of 1,2,3, shouldn't the lines be 1,n,n? Next?
Both are allowed, the latter syntax is more flexible when you add new lines, however, you won't be doing so for vicidial, at least not often.

Both the inbound and outbound should have, or rather, share, the same
You do not need global string for inbound, since all calls are dumped in the same context where AGI script takes care.
For the outbound part it's just for convenience and maybe not displaying account details in CLI (cannot confirm that, never tested it) - rather than using :
Code: Select all
exten => _91999NXXXXXX,2,Dial(SIP/USER:PASSWORD@HOST/${EXTEN:2},,To)
or whatever, you use:
Code: Select all
myglobalstring=SIP/USER:PASSWORD@HOST
or
myglobalstring=SIP/accountentry
exten => _91999NXXXXXX,2,Dial(${myglobalstring}/${EXTEN:2},,To)
where accountentry is the peer created, like:
Code: Select all
[accountentry]
username=...
secret=...
type=peer
host=....


By the way, all this is well covered in the book you mentioned and is pure asterisk question, not vicidial one.

Re: dialplan_entry for a carrier (outbound)

PostPosted: Wed Apr 01, 2015 3:04 pm
by THUFIR
okli wrote:
instead of 1,2,3, shouldn't the lines be 1,n,n? Next?
Both are allowed, the latter syntax is more flexible when you add new lines, however, you won't be doing so for vicidial, at least not often.

Both the inbound and outbound should have, or rather, share, the same
You do not need global string for inbound, since all calls are dumped in the same context where AGI script takes care.
For the outbound part it's just for convenience and maybe not displaying account details in CLI (cannot confirm that, never tested it) - rather than using :
Code: Select all
exten => _91999NXXXXXX,2,Dial(SIP/USER:PASSWORD@HOST/${EXTEN:2},,To)
or whatever, you use:
Code: Select all
myglobalstring=SIP/USER:PASSWORD@HOST
or
myglobalstring=SIP/accountentry
exten => _91999NXXXXXX,2,Dial(${myglobalstring}/${EXTEN:2},,To)
where accountentry is the peer created, like:
Code: Select all
[accountentry]
username=...
secret=...
type=peer
host=....


By the way, all this is well covered in the book you mentioned and is pure asterisk question, not vicidial one.



Admittedly, I don't understand the Asterisk language, didn't even realize it was its own language until just a few days ago.

When you say "inbound" what is that in relation to? The agent is only receiving SIP calls from vicidial, so those are inbound calls from that perspective. Of course, they're outbound dialing calls. Can you expand just a little on that?

Re: dialplan_entry for a carrier (outbound)

PostPosted: Thu Apr 02, 2015 4:12 am
by okli
Admittedly, I don't understand the Asterisk language, didn't even realize it was its own language until just a few days ago.
Umm.., you didn't expect it to speak French, or SQL, or C#, right? :)
When you say "inbound" what is that in relation to?
Inbound from outside world/provider, not internal for asterisk in-out calls.