ChanCapi‎ > ‎

ChanCapiCallCompletion

CCBS / CCNR


Call completion is a service provided by some ISDN providers or PBXs.

CCBS

chan-capi now (since version 1.0.2) supports CCBS (call completion on busy subscriber).

This means, if you dial a number via CAPI and the called party is busy, you may activate CCBS.
As soon as the remote party becomes free, an internal asterisk event is created which allows you
to Dial the same connection again to complete the call.

Here is a short example on how this can be used:

[dialout]
; your standard dialout context
exten => _0X.,1,capicommand(peerlink) ;this is needed to let chan-capi know who is the called channel
exten => _0X.,2,Dial(CAPI/contr1/${EXTEN}/s,,g)
exten => _0X.,3,NoOp(ID=${CCLINKAGEID})  ;if ${CCLINKAGEID} contains a number, CCBS is possible
; here you should ask the caller if CCBS shall be activated
exten => _0X.,4,capicommand(ccbs|${CCLINKAGEID}|ccbs-signal|${CALLERID(number)}|1)
exten => _0X.,5,NoOp(CCBSSTATUS=${CCBSSTATUS})  ;announce success?
exten => _0X.,6,capicommand(hangup) ;since 's' option on dial was used, the capi channel should be hung up now
exten => _0X.,7,Hangup

[ccbs-signal]
; this is triggered when the network signals 'remote party free'
exten => _X.,1,NoOp(${CALLERID(number)})   ;this is the linkage-ID
exten => _X.,2,System(/bin/ccbs.sh ${CALLERID(number)} ${EXTEN}) ; EXTEN is the original caller (see prio 4 above)
exten => _X.,3,Hangup

[ccbs-callback]
; this should be activated by the calloutfile (or manager API)
exten => _X.,1,Dial(CAPI/ccbs/${EXTEN}/b) ; EXTEN is the linkage-ID, see callout file
exten => _X.,2,Hangup


Here is an example to create the callout file when the remote party becomes free:

/bin/ccbs.sh:
#!/bin/sh
LINKID=$1
NUMBER=$2
(
   echo "Channel: SIP/$NUMBER"
   echo "MaxRetries: 0"
   echo "RetryTime: 60"
   echo "WaitTime: 30"
   echo "Context: ccbs-callback"
   echo "Extension: $LINKID"
   echo "Priority: 1"
) > /tmp/callfile.$LINKID
mv /tmp/callfile.$LINKID /var/spool/asterisk/outgoing/


CCNR

Not yet implemented.