Busy call back in SIP Trunk

Hi All,

I am trying to implement an RFC 6910 based application using Asterisk,

It provides a “completion of calls” feature defined in this specification that allows the caller of a failed call to be notified when the callee becomes available to receive a call.

in general, it’s called busy call back,

Eg: User_A in PBX(A) dials to User_B in PBX(B), User A gets a busy tone/message if user b is busy with a call then User_A press a specific key (DTMF) to set the callback. whenever the User_A finishes his call the PBX(A) dialls to User_A and User_B automatically and connect together.

Please let me know if anyone has done the above before already, or kindly support me to do the above task.

Please refer below basic concept I am planning to do,

in my scenario, I have a Proprietary PBX that works in RFC6910 and I need to connect an Asterisk to get the above feature done.

My Concept,

  • Asterisk PBX --------- SIP with RFC6910------> - Proprietary PBX -

Since the Asterisk does not support RFC6910, I am trying to write an AGI Script to send and receive the RFC6910 based massagers listed below,
In coming Call

  1. Send “486 Busy Here” (If Asterisk side User is busy)
    Session Initiation Protocol (486)
    Status-Line: SIP/2.0 486 Busy Here
    Status-Code: 486

  2. Receive “SUBSCRIBE” if User_A press DTMF and store it in a database,
    Sequence Number: 1
    Method: SUBSCRIBE

  3. Send 200 OK after receiving “SUBSCRIBE”
    CSeq: 2 PRACK
    Sequence Number: 2
    Method: PRACK

  4. Send NOTIFY (with the Asterisk side user status)

    Message Body
    cc-state: queued\r\n (If busy)
    cc-URI: sip:CC_856;76 @;transport=UDP\r\n
    cc-service-retention: true\r\n

    Message Body
    cc-state: ready\r\n (If busy)
    cc-URI: sip: CC_856;76 @;transport=UDP\r\n
    cc-service-retention: true\r\n

Out Going Call

  1. Send “SUBSCRIBE” and DTMF if 486 Bust here received,
  2. Send Invite if “cc-state: ready” in NOTIFY Message
    Kindly, advise me on,
  3.    Can i send specific SIP Messages using Asterisk Dial plan? if yes please share an example,
  4.    if above is no, can i use AGI to send specific SIP Messages? if yes please share an example,
  5.    if above is no, what is the possible method to address above task?


  1. No
  2. No

Asterisk doesn’t provide low level access to such things, it’s not a SIP stack or low level SIP server. The chan_sip module does have support for call completion stuff, I don’t know if it’s the specific RFC, and it also hasn’t been touched in years. The chan_pjsip module does not have this support.

Looking at


there seems to be a generic mode, which uses dialled numbers, and looks to me should work on any channel type, and a native mode, which could, but might not implement the RFC, for SIP, and is only available for certain channel types.

Also note that returning 486 on BUSY is normal behaviour and not conditional on call completion services, although you may find the definition of BUSY is quite narrow.

The details under your step 3 of the protocol look wrong.

I’d agree that implementing the RFC from scratch is something that could only be implemented within the channel driver, and is therefore outside the scope of this forum.

Hi Jcolp,

Thanks for the prompt response,

Does that mean we cannot send customized SIP Messages using the Asterisk server?


Hi david,

Thanks for the responce,

I tried The Call Completion Process - Asterisk Project - Asterisk Project Wiki , but it’s only for Asterisk internal Extensions as per my reading. please correct me if ii am worng.

Following is the call flow as per the RFC6910 and i can observe the same in my Proprietary PBX since I have done live Wireshark trace,

Caller Callee
sip:123@a.com sip:456@b.com
| |
| INVITE sip:456@b.com | [original call]
| From: sip:123@a.com |
| |
| 487 |
| Call-Info:sip:456@z.b.com;purpose=call-completion;m=NR
| |
| SUBSCRIBE sip:456@z.b.com;m=NR [initial SUBSCRIBE]
| From: sip:123@a.com |
| Contact: sip:123@y.a.com |
| Request-Disposition: parallel
| Call-Id: abcd-efgh |
| Event: call-completion |
| |
| 200 |
| |
| NOTIFY sip:123@y.a.com | [initial NOTIFY]
| Body: cc-state: queued |
| |
| SUBSCRIBE sip:456@b.com;m=NR [another init. SUB.]
| From: sip:foo@example.com |
| Request-Disposition: parallel
| Call-Id: abcd-efgh |
| Event: call-completion |
| |
| 482 | [duplicate SUB. rej.]
| |
| NOTIFY sip:123@y.a.com | [CC invoked]
| Body: cc-state: ready |
| URI: sip:recall@z.b.com
| |
| INVITE sip:recall@z.b.com;m=NR [CC call]
| From: sip:foo@example.com|
| |
| NOTIFY sip:123@y.a.com | [CC terminated]
| Expires = 0 |

As per the trace, After the call gets answered (200 OK) if the extension is busy then the server sends 486 with the following information inside,
Call-Info: sip:4003@;user=phone;tgrp=2;trunk-context=mxone-1;purpose=call-completion;m=BS
Then the Caller can dial the DTMF since it’s an answered call,

Can’t we do the above using AGI file? please sugest and help

As per the last point in your answer, can I get the status of the extension (Busy or available) using “channel driver” through SIP Trunk? if yes kindly share any sample coding


No. As Joshua has already said.

That doesn’t make sense. Extensions are neither internal nor external. Did you mean directly connected devices. Asterisk can only monitor device state on directly connected devices. That isn’t limited to Asterisk, as there is no way of testing the state of PSTN number other than actually calling it.

Asterisk doesn’t support SIP for remote presence, and, in any case, no ITSP is going to provide it, partly because the PSTN doesn’t support it.

The only sensible interpretation of this is the machine running Asterisk, which can, of course run other software. Asterisk is a daemon and acts as both server and client for SIP, and, for example is a client when sending NOTIFY.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.