Call Diversion

Home » Asterisk Users » Call Diversion
Asterisk Users No Comments

Hi all,

i’m trying to setup a function like “secretary/director”: when an user call director number (eg. 5000), the call were firstly diverted to secretary (5001). At this point, when secretary answer, can decide to transfer back the call to director (5000).

Because i’m using OpenSIPS as SIP router, when this function is needed i did a special “extension” like DIVERT_[from]_[to]:

exten => _DIVERT_.,1,Noop(“from-voip: DIVERT ${CALLERID(num)} –
${EXTEN}”) ; Example: DIVERT_5000_5001
exten => _DIVERT_.,n,Set(DIVFrom=${CUT(EXTEN,_,2)})
exten => _DIVERT_.,n,Set(DIVTo=${CUT(EXTEN,_,3)})
exten => _DIVERT_.,n,Noop(“Divert ${CALLERID(num)} from ${DIVFrom} to
exten => _DIVERT_.,n,Macro(services-divert) // Divert exten => _DIVERT_.,n,Hangup()

and a macro like:

[macro-services-divert] ; Servizio direttore-segretaria exten => s,1,Noop(“Divert from ${CALLERID(num)}”)
same => n,Answer same => n,Playback(msg/msg_attendereufficiodesiderato)
same => n,Dial(SIP/voip-trunk/${DIVTo},30)

It works *BUT* when from the secretary phone the call were forwarded back to director (and, at this point, director phone must ring !), the call stall with an error on OpenSIPS like:

In-Dialog NOTIFY from [my asterisk box ip]
(callid=707902a659eb005b141a9491195bd3cf@voip) is not valid according to dialog

Any hits ?