Advertisement
conformist

chan_dongle ext

Feb 16th, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.34 KB | None | 0 0
  1. # cat extensions.conf
  2. ; this is chunks of Asterisk extensions.conf file for show some chan_dongle features
  3. [general]
  4.  
  5. [dongle-incoming]
  6. ; example of ussd receive
  7. exten => ussd,1,Set(type=${USSD_TYPE})
  8.     ; values from 0 till 5
  9.     ;  0 - 'USSD Notify'
  10.     ;  1 - 'USSD Request'
  11.     ;  2 - 'USSD Terminated by network'
  12.     ;  3 - 'Other local client has responded'
  13.     ;  4 - 'Operation not supported'
  14.     ;  5 - 'Network time out'
  15.  
  16. exten => ussd,n,Set(typestr=${USSD_TYPE_STR})
  17.     ; type in string, see above
  18.  
  19. exten => ussd,n,Set(ussd=${USSD})
  20.     ; USSD text, but may be truncated by first \n
  21.  
  22. exten => ussd,n,Set(ussd_multiline=${BASE64_DECODE(${USSD_BASE64})})
  23.     ; USSD text, may be multiline
  24. ; Note:  this exten run in Local channel not attached to anything, also all CALLERID() is empty
  25.  
  26. exten => ussd,n,Hangup
  27.  
  28.  
  29. ; example of sms receive
  30. exten => sms,1,Set(sms=${SMS})
  31.     ; SMS text, but may be truncated by first \n
  32.  
  33. exten => sms,n,Set(sms_multiline=${BASE64_DECODE(${SMS_BASE64})})
  34.     ; SMS text, may be multiline
  35.  
  36. exten => sms,n,Set(raw_cmgr_message=${CMGR})
  37.     ; raw CMGR message from dongle
  38.  
  39. ; Note:  this exten run in Local channel not attached to anything, also CALLERID(num) is address of SMS originator
  40.  
  41. exten => sms,n,Hangup
  42.  
  43.  
  44. ; example of begining context execution from not default exten
  45. exten => +12345678901,1,Verbose(This exten executed if Subscriber Number is available and equal +12345678901 or exten setting value is +12345678901)
  46. exten => +12345678901,n,Hangup
  47.  
  48.  
  49. ; example of channel variables setting by chan_dongle
  50. exten => s,1,Set(NAME_OF_DEVICE=${DONGLE0_STATUS})
  51.     ; for example 'dongle0' or 'dongle1' see dongle.conf
  52.  
  53. exten => s,n,Set(NAME_OF_PROVIDE=${DONGLEPROVIDER})
  54.     ; for example see output of cli 'dongle show devices' column "Provider Name"
  55.  
  56. exten => s,n,Set(IMEI_OF_DEVICE=${DONGLEIMEI})
  57.     ; for example see output of cli 'dongle show devices' column "IMEI"
  58.  
  59. exten => s,n,Set(IMSI_OF_SIMCARD=${DONGLEIMSI})
  60.     ; for example see output of cli 'dongle show devices' column "IMSI"
  61.  
  62. exten => s,n,Set(SUBSCRIBER_NUMBER=${DONGLENUMBER})
  63.     ; Subscriber Number example see output of cli 'dongle show devices' column "Number"
  64.     ;   may be empty, use for save in SIM commands AT+CPBS="ON" and  AT+CPBW=1,"+123456789",145
  65.  
  66. exten => s,n,Set(CNUM_NUMBER=${CALLERID(dnid)})
  67.     ; Set to Subscriber Number if available
  68.  
  69. ; applications of chan_dongle
  70.  
  71. exten => s,n,DongleStatus(dongle0,DONGLE0_STATUS)
  72. exten => s,n,DongleStatus(g1,DONGLE1_STATUS)
  73. exten => s,n,DongleStatus(r1,DONGLE2_STATUS)
  74. exten => s,n,DongleStatus(p:PROVIDER NAME,DONGLE3_STATUS)
  75. exten => s,n,DongleStatus(i:123456789012345,DONGLE4_STATUS)
  76. exten => s,n,DongleStatus(s:25099,DONGLE5_STATUS)
  77.     ; for first argument see Dial() Resource part of dial string
  78.     ; get status of device and store result in variable
  79.     ; possible values of ${DONGLE0_STATUS}
  80.     ;   -1 invalid argument
  81.     ;    1 device not found
  82.     ;    2 device connected and free
  83.     ;    3 device connected and in use
  84.  
  85. exten => s,n,DongleSendSMS(dongle0,+18004005422,"Hello how are you, Danila?",1440,yes)
  86.     ; send SMS on selected device and to specified number
  87.     ;   device          name of Dongle device
  88.     ;   destination number  in International format with leading '+' or w/o leading '+'
  89.     ;   message         maximum 70 UCS-2 symbols
  90.     ;   validity period     in minutes, will be round up to nearest possible value, optional default is 3 days
  91.     ;   report request      if true report for this SMS is required, optional default is not
  92.  
  93.  
  94. ; functions of chan_dongle
  95.  
  96. exten => s,n,GotoIf($["${CHANNEL(callstate)}" = "waiting"]?waiting-call)
  97.     ; now we provide channel function argument callstate
  98.     ;   possible values
  99.     ;       active      ; enjoy and speek
  100.     ;       held        ; this call is held
  101.     ;       dialing     ; for outgoing calls
  102.     ;       alerting    ; for outgoing calls, number dialed and called party ringing
  103.     ;       incoming    ; for incoming calls
  104.     ;       waiting     ; for incoming waiting calls;
  105.     ;                              if callwaiting=no channels for waiting calls never created
  106.  
  107.     ;       initialize  ; never appear
  108.     ;       released    ; never appear
  109.  
  110.     ; Answer on waiting call activate this call and place any other active calls
  111.     ;   on hold, but execution of dialplan for these calls not break stopped or frozen
  112.     ;   When active call terminated one of held becomes active.
  113.  
  114. exten => s,n,Set(CHANNEL(callstate)=active)
  115.     ; if callstate is 'held' you can assign new value 'active'
  116.     ;   its mean activate this call and place on hold all other active calls but
  117.     ;   execution of dialplan for these calls not break stopped or frozen
  118.  
  119. exten => s,n,Dial(Dongle/dongle0/+79139131234)
  120. exten => s,n,Dial(Dongle/g1/+79139131234)
  121. exten => s,n,Dial(Dongle/r1/879139131234)
  122. exten => s,n,Dial(Dongle/p:PROVIDER NAME/+79139131234)
  123. exten => s,n,Dial(Dongle/i:123456789012345/+79139131234)
  124. exten => s,n,Dial(Dongle/s:25099/+79139131234)
  125.     ; make outgoing call
  126.     ;  name on device with this name
  127.     ;  g1 on first free device in group 1
  128.     ;  r1 round robin devices in group 1
  129.     ;  p: with first free device with Operator name beggining with name
  130.     ;  i: with device exactly matched IMEI
  131.     ;  s: with first free device with IMSI prefix
  132.  
  133. exten => s,n,Dial(Dongle/g1/holdother:+79139131234)
  134. exten => s,n,Dial(Dongle/r1/holdother:+79139131234)
  135. exten => s,n,Dial(Dongle/p:PROVIDER NAME/holdother:+79139131234)
  136. exten => s,n,Dial(Dongle/i:123456789012345/holdother:+79139131234)
  137. exten => s,n,Dial(Dongle/s:25099/holdother:+79139131234)
  138.     ; now we add option 'holdother' for dialing
  139.     ;    this option do
  140.     ;       1) When looking for available devices by group, provider IMEI,
  141.     ;           IMSI prefix not ignore devices with whose state does not
  142.     ;                   prohibit a new outgoing call when other call place on hold
  143.     ;
  144.     ;       2) Before actual dialing place active calls on hold
  145.     ;                  but execution of dialplan for these calls not break stopped or frozen
  146.     ;       3) This call will be active if succesfully answered
  147. ; BUG !!!
  148. ;  tested for call waiting and hold features Huawei E1550 has a next bug:
  149. ;    When local side hangup any call including held call ALL other calls LOST sound
  150. ;    When remove side hangup active call ALL other calls LOST sound
  151. ; Please double check true this for you or not
  152. ;  If true reduce usage of this useful features
  153.  
  154. exten => s,n,Dial(Dongle/g1/conference:+79139131234)
  155. exten => s,n,Dial(Dongle/r1/conference:+79139131234)
  156. exten => s,n,Dial(Dongle/p:PROVIDER NAME/conference:+79139131234)
  157. exten => s,n,Dial(Dongle/i:123456789012345/conference:+79139131234)
  158. exten => s,n,Dial(Dongle/s:25099/conference:+79139131234)
  159.     ; and also option 'conference' added
  160.     ;    this option do
  161.     ;       1) When looking for available devices by group, provider IMEI,
  162.     ;           IMSI prefix not ignore devices with whose state does not
  163.     ;                   prohibit a new outgoing call when other call place on hold
  164.     ;
  165.     ;       2) Before actual dialing place active calls on hold
  166.     ;                  but execution of dialplan for these calls not break stopped or frozen
  167.     ;       3) If answered attach hold calls to conrefence (in term of GSM)
  168.     ; Also if created outgoing channel place call on same device that incoming channel
  169.     ;  both incoming and outgoing channels become readonly to avoid the voice loop.
  170.     ;
  171.     ; see also BUG !!! note above
  172.  
  173. exten => s,n,Hangup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement