[Asterisk-Users] A question about transfering calls

Chris Bagnall asterisk at minotaur.cc
Sun Nov 27 10:03:03 MST 2005


> I have a question about transfering calls. If I transfer a 
> call to extension 4000 and nobody answers I want the call to 
> be returned bak to me at extension 1000. How do I do that? 
> Any help is apreciated! many thanks! 

Try something like this:

macro internal (dialstring, fallback, timeout) {
  Dial (${dialstring},${timeout});
    switch (${DIALSTATUS}) {
      default:
        if ("${fallback}" != "") {
          &internal (${fallback},,,${timeout});
        } else {
          // however you normally handle non-answering (voicemail, etc.)
        };
    };
};

The dialstatus switch could be used to handle busy calls differently, for
example.

If you dial extensions in your dialplan like this:
exten => _2XX,1,Dial(SIP/${EXTEN},20)
Then try this instead:
exten => _2XX,1,Macro(internal,SIP/${EXTEN},SIP/${CALLERID(number)},20)

So the fallback route is defined as the originating callerid. You might want
to use a different method of identifying your fallback route.

Regards,

Chris
-- 
C.M. Bagnall, Director, Minotaur I.T. Limited
This email is made from 100% recycled electrons





More information about the asterisk-users mailing list