[Asterisk-Users] Camping-on-busy

Chris Bagnall asterisk at minotaur.cc
Sat Nov 26 06:19:11 MST 2005


Hello all,

I'm trying to write a macro that'll handle blind SIP transfers nicely, since
at present, blind transferring to a busy SIP extension will give the
incoming caller busy tones.

Hopefully this will be of use to others on the list once it's working
correctly. Here's what I've got so far:

macro internal (dialstring, mailbox, fallback, timeout) {
  Dial (${dialstring},${timeout},w);
    switch (${DIALSTATUS}) {
      case BUSY:
        Queue (${dialstring:-3:3},t);
        Playtones (busy);
        Busy ();
        break;
      default:
        if ("${mailbox}" != "") {
          &voicemail (u,${mailbox});
        } else if ("${fallback}" != "") {
          &internal (${fallback},,,${timeout});
        } else {
          Playtones (congestion);
          Congestion ();
        };
    };
};

context campingqueue {
  1 => if ("${fallback}" != "")
             &internal (${fallback},,,${timeout});
  2 => if ("${mailbox}" != "")
             &voicemail (b,${mailbox});
};

The macro is called as follows:
exten => _2XX,1,Macro(internal,SIP/${EXTEN},mbox,Local/200,20)

Parameters are: 1) dialstring, 2) mailbox, 3) fallback route, 4) dial
command timeout

It should do the following:
1) dial the specified extension
if busy, put the caller into the camping queue for that extension giving the
caller the following options:
	1 - speak to someone else (fallback)
	2 - leave VM (if mailbox specified)
if any other (non-busy) condition, do the following:
	if mailbox specified, go to VM
	if fallback specified, dial new extension
	if neither of the above, play no answer sound

Queues of the same name as the extension need to be defined in queues.conf,
e.g.:
[204]
strategy                    = ringall
context                     = campingqueue
timeout                     = 0
weight                      = 1
announce-frequency          = 0
periodic-announce-frequency = 60
periodic-announce           = queue-periodic-announce
joinempty                   = no
leavewhenempty              = yes

It works fine with one exception - when the caller hits "1" whilst camping
(to fallback to another extension such as a global hunt group), then hangs
up whilst the fallback is ringing, the fallback keeps ringing until it times
out - it does not acknowledge that the original caller has hung up. Any way
around that?

Thanks in advance.

Regards,

Chris
-- 
C.M. Bagnall, Director, Minotaur I.T. Limited
Tel: (01604) 808408   Mobile: (07811) 332969   Skype: minotaur-uk
ICQ: 13350579   AIM: MinotaurUK   MSN: msn at minotaur.cc   Y!: Minotaur_Chris
This email is made from 100% recycled electrons





More information about the asterisk-users mailing list