Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # cat extensions.conf
- ; this is chunks of Asterisk extensions.conf file for show some chan_dongle features
- [general]
- [dongle-incoming]
- ; example of ussd receive
- exten => ussd,1,Set(type=${USSD_TYPE})
- ; values from 0 till 5
- ; 0 - 'USSD Notify'
- ; 1 - 'USSD Request'
- ; 2 - 'USSD Terminated by network'
- ; 3 - 'Other local client has responded'
- ; 4 - 'Operation not supported'
- ; 5 - 'Network time out'
- exten => ussd,n,Set(typestr=${USSD_TYPE_STR})
- ; type in string, see above
- exten => ussd,n,Set(ussd=${USSD})
- ; USSD text, but may be truncated by first \n
- exten => ussd,n,Set(ussd_multiline=${BASE64_DECODE(${USSD_BASE64})})
- ; USSD text, may be multiline
- ; Note: this exten run in Local channel not attached to anything, also all CALLERID() is empty
- exten => ussd,n,Hangup
- ; example of sms receive
- exten => sms,1,Set(sms=${SMS})
- ; SMS text, but may be truncated by first \n
- exten => sms,n,Set(sms_multiline=${BASE64_DECODE(${SMS_BASE64})})
- ; SMS text, may be multiline
- exten => sms,n,Set(raw_cmgr_message=${CMGR})
- ; raw CMGR message from dongle
- ; Note: this exten run in Local channel not attached to anything, also CALLERID(num) is address of SMS originator
- exten => sms,n,Hangup
- ; example of begining context execution from not default exten
- exten => +12345678901,1,Verbose(This exten executed if Subscriber Number is available and equal +12345678901 or exten setting value is +12345678901)
- exten => +12345678901,n,Hangup
- ; example of channel variables setting by chan_dongle
- exten => s,1,Set(NAME_OF_DEVICE=${DONGLE0_STATUS})
- ; for example 'dongle0' or 'dongle1' see dongle.conf
- exten => s,n,Set(NAME_OF_PROVIDE=${DONGLEPROVIDER})
- ; for example see output of cli 'dongle show devices' column "Provider Name"
- exten => s,n,Set(IMEI_OF_DEVICE=${DONGLEIMEI})
- ; for example see output of cli 'dongle show devices' column "IMEI"
- exten => s,n,Set(IMSI_OF_SIMCARD=${DONGLEIMSI})
- ; for example see output of cli 'dongle show devices' column "IMSI"
- exten => s,n,Set(SUBSCRIBER_NUMBER=${DONGLENUMBER})
- ; Subscriber Number example see output of cli 'dongle show devices' column "Number"
- ; may be empty, use for save in SIM commands AT+CPBS="ON" and AT+CPBW=1,"+123456789",145
- exten => s,n,Set(CNUM_NUMBER=${CALLERID(dnid)})
- ; Set to Subscriber Number if available
- ; applications of chan_dongle
- exten => s,n,DongleStatus(dongle0,DONGLE0_STATUS)
- exten => s,n,DongleStatus(g1,DONGLE1_STATUS)
- exten => s,n,DongleStatus(r1,DONGLE2_STATUS)
- exten => s,n,DongleStatus(p:PROVIDER NAME,DONGLE3_STATUS)
- exten => s,n,DongleStatus(i:123456789012345,DONGLE4_STATUS)
- exten => s,n,DongleStatus(s:25099,DONGLE5_STATUS)
- ; for first argument see Dial() Resource part of dial string
- ; get status of device and store result in variable
- ; possible values of ${DONGLE0_STATUS}
- ; -1 invalid argument
- ; 1 device not found
- ; 2 device connected and free
- ; 3 device connected and in use
- exten => s,n,DongleSendSMS(dongle0,+18004005422,"Hello how are you, Danila?",1440,yes)
- ; send SMS on selected device and to specified number
- ; device name of Dongle device
- ; destination number in International format with leading '+' or w/o leading '+'
- ; message maximum 70 UCS-2 symbols
- ; validity period in minutes, will be round up to nearest possible value, optional default is 3 days
- ; report request if true report for this SMS is required, optional default is not
- ; functions of chan_dongle
- exten => s,n,GotoIf($["${CHANNEL(callstate)}" = "waiting"]?waiting-call)
- ; now we provide channel function argument callstate
- ; possible values
- ; active ; enjoy and speek
- ; held ; this call is held
- ; dialing ; for outgoing calls
- ; alerting ; for outgoing calls, number dialed and called party ringing
- ; incoming ; for incoming calls
- ; waiting ; for incoming waiting calls;
- ; if callwaiting=no channels for waiting calls never created
- ; initialize ; never appear
- ; released ; never appear
- ; Answer on waiting call activate this call and place any other active calls
- ; on hold, but execution of dialplan for these calls not break stopped or frozen
- ; When active call terminated one of held becomes active.
- exten => s,n,Set(CHANNEL(callstate)=active)
- ; if callstate is 'held' you can assign new value 'active'
- ; its mean activate this call and place on hold all other active calls but
- ; execution of dialplan for these calls not break stopped or frozen
- exten => s,n,Dial(Dongle/dongle0/+79139131234)
- exten => s,n,Dial(Dongle/g1/+79139131234)
- exten => s,n,Dial(Dongle/r1/879139131234)
- exten => s,n,Dial(Dongle/p:PROVIDER NAME/+79139131234)
- exten => s,n,Dial(Dongle/i:123456789012345/+79139131234)
- exten => s,n,Dial(Dongle/s:25099/+79139131234)
- ; make outgoing call
- ; name on device with this name
- ; g1 on first free device in group 1
- ; r1 round robin devices in group 1
- ; p: with first free device with Operator name beggining with name
- ; i: with device exactly matched IMEI
- ; s: with first free device with IMSI prefix
- exten => s,n,Dial(Dongle/g1/holdother:+79139131234)
- exten => s,n,Dial(Dongle/r1/holdother:+79139131234)
- exten => s,n,Dial(Dongle/p:PROVIDER NAME/holdother:+79139131234)
- exten => s,n,Dial(Dongle/i:123456789012345/holdother:+79139131234)
- exten => s,n,Dial(Dongle/s:25099/holdother:+79139131234)
- ; now we add option 'holdother' for dialing
- ; this option do
- ; 1) When looking for available devices by group, provider IMEI,
- ; IMSI prefix not ignore devices with whose state does not
- ; prohibit a new outgoing call when other call place on hold
- ;
- ; 2) Before actual dialing place active calls on hold
- ; but execution of dialplan for these calls not break stopped or frozen
- ; 3) This call will be active if succesfully answered
- ; BUG !!!
- ; tested for call waiting and hold features Huawei E1550 has a next bug:
- ; When local side hangup any call including held call ALL other calls LOST sound
- ; When remove side hangup active call ALL other calls LOST sound
- ; Please double check true this for you or not
- ; If true reduce usage of this useful features
- exten => s,n,Dial(Dongle/g1/conference:+79139131234)
- exten => s,n,Dial(Dongle/r1/conference:+79139131234)
- exten => s,n,Dial(Dongle/p:PROVIDER NAME/conference:+79139131234)
- exten => s,n,Dial(Dongle/i:123456789012345/conference:+79139131234)
- exten => s,n,Dial(Dongle/s:25099/conference:+79139131234)
- ; and also option 'conference' added
- ; this option do
- ; 1) When looking for available devices by group, provider IMEI,
- ; IMSI prefix not ignore devices with whose state does not
- ; prohibit a new outgoing call when other call place on hold
- ;
- ; 2) Before actual dialing place active calls on hold
- ; but execution of dialplan for these calls not break stopped or frozen
- ; 3) If answered attach hold calls to conrefence (in term of GSM)
- ; Also if created outgoing channel place call on same device that incoming channel
- ; both incoming and outgoing channels become readonly to avoid the voice loop.
- ;
- ; see also BUG !!! note above
- exten => s,n,Hangup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement