Help required with Asterisk call forwarding

Hello Experts,

I have setup a asterisk 1.6.2 PBX server with 3 sip phone, I'm testing call forwarding feature.

Following is my extension.conf

[general]

writeprotect=no

priorityjumping=yes

include => parkedcalls

[group1]

include => parkedcalls

exten => _1XXX,1,Dial(SIP/${EXTEN},10,tr)

exten => _1XXX,2, VoiceMail(${EXTEN}@voicemail_test,u,b)

exten => _1XXX,3,Playback(vm-goodbye)

exten => _1XXX,4,Hangup()

exten => 9998,1,VoiceMailMain(_1XXX@voicemail_test)

; Unconditional Call Forward

exten => _*21*X.,1,NoCDR

exten => _*21*X.,2,Set(DB(CFIM/${CALLERID(NUM)})=${EXTEN:4})

exten => _*21*X.,3,Playback(vm-saved)

exten => _*21*X.,4,Hangup

exten => _1XXX,1,Set(temp=${DB(CFIM/${EXTEN})})

exten => _1XXX,n,GotoIf($[${LEN(${temp})}<4]?local:outcall)

exten => _1XXX,n(local),GotoIf($[${LEN(${temp})}>0]?sipfr:sipnofr)

exten => _1XXX,n(sipfr),SetCallerID(${CALLERID(NUM):7})

exten => _1XXX,n(sipfr),NoOp(${tcid})

exten => _1XXX,n(sipfr),Dial(SIP/${temp},20,T) ; Unconditional forward

exten => _1XXX,n(sipfr),Hangup

The First section of the code works, That is on extn 1000  I dial *21*1001 and get below message on Asterisk console

CLI>   == Using SIP RTP CoS mark 5
    -- Executing [*21*1001@group1:1] NoCDR("SIP/1000-00000006", "") in new stack
    -- Executing [*21*1001@group1:2] Set("SIP/1000-00000006", "DB(CFIM/1000)=1001") in new stack
    -- Executing [*21*1001@group1:3] Playback("SIP/1000-00000006", "vm-saved") in new stack
    -- <SIP/1000-00000006> Playing 'vm-saved.gsm' (language 'jp')
    -- Executing [*21*1001@group1:4] Hangup("SIP/1000-00000006", "") in new stack
  == Spawn extension (group1, *21*1001, 4) exited non-zero on 'SIP/1000-00000006'

But when I dial from extn 1002 to 1000 it does not forward the call to 1001 but rings 1000 instead

CLI>   == Using SIP RTP CoS mark 5
    -- Executing [1000@group1:1] Dial("SIP/1002-00000007", "SIP/1000,10,tr") in new stack
  == Using SIP RTP CoS mark 5
    -- Called 1000
    -- SIP/1000-00000008 is ringing
    -- SIP/1000-00000008 is ringing

Any help on this appreciated

Regards,
Anantha
AnanthahkAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

grbladesCommented:
You have _1xxx defined twice. Comment out the first block and reload then it should work
0
AnanthahkAuthor Commented:
Hello I did not understand which section of the code to block, can you please be more specific
0
grbladesCommented:
You have this code in there first
exten => _1XXX,1,Dial(SIP/${EXTEN},10,tr)
exten => _1XXX,2, VoiceMail(${EXTEN}@voicemail_test,u,b)
exten => _1XXX,3,Playback(vm-goodbye)
exten => _1XXX,4,Hangup()

Then later you have the correct code
exten => _1XXX,1,Set(temp=${DB(CFIM/${EXTEN})})
exten => _1XXX,n,GotoIf($[${LEN(${temp})}<4]?local:outcall)
exten => _1XXX,n(local),GotoIf($[${LEN(${temp})}>0]?sipfr:sipnofr)
exten => _1XXX,n(sipfr),SetCallerID(${CALLERID(NUM):7})
exten => _1XXX,n(sipfr),NoOp(${tcid})
exten => _1XXX,n(sipfr),Dial(SIP/${temp},20,T) ; Unconditional forward
exten => _1XXX,n(sipfr),Hangup

The problem you are having is because asterisk is loading the first block and ignoring the second. You need to comment out the first block and reload the config so that the correct code is used.
0
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

AnanthahkAuthor Commented:
But If I remove first code, my basic dial features does not work anymore

I understand that there is some clash happening between the first and second code

Cant there be more simple code for call forwarding ?
0
grbladesCommented:
What are the SIP devices?
If they are desk phones then most phones support configuring call forwarding on the phone.

Otherwise you will need to fix the dialplan you wrote so that it does all that you want.

You have multiple errors in your dialplan anyway such as your internal extensions being 4 digits but your check for local was <4 not <5. Try this instead as a starting point.

exten => _1XXX,1,Set(temp=${DB(CFIM/${EXTEN})})
exten => _1XXX,n,GotoIf($[${LEN(${temp})}<5]?local:outcall)
exten => _1XXX,n(local),GotoIf($[${LEN(${temp})}>0]?sipfr:sipnofr)
exten => _1XXX,n(sipfr),SetCallerID(${CALLERID(NUM):7})
exten => _1XXX,n,NoOp(${tcid})
exten => _1XXX,n,Dial(SIP/${temp},20,T) ; Unconditional forward
exten => _1XXX,n,VoiceMail(${EXTEN}@voicemail_test,u,b)
exten => _1XXX,n,Hangup
exten => _1XXX,n(sipnofr),Dial(SIP/${EXTEN},20,tr)
exten => _1XXX,n,VoiceMail(${EXTEN}@voicemail_test,u,b)
exten => _1XXX,n(outcall),NoOp(This gets rung when a call is forwarded to an extenal number but I dont know how to call it.)

0
AnanthahkAuthor Commented:
Hello Thanks for Feedback

I have SIP hard phones and yes I could test call forwarding though phone, I also tried your code

My basic dial plan works with this new code but still call forward is not working, error message "No application 'SetCallerID' " Has some module failed to load ?

Also How do I remove the call forwarding number that is set

console message
CLI>
*CLI>   == Using SIP RTP CoS mark 5
    -- Executing [*21*1000@group1:1] NoCDR("SIP/1002-00000003", "") in new stack
    -- Executing [*21*1000@group1:2] Set("SIP/1002-00000003", "DB(CFIM/1002)=1000") in new stack
    -- Executing [*21*1000@group1:3] Playback("SIP/1002-00000003", "vm-saved") in new stack
    -- <SIP/1002-00000003> Playing 'vm-saved.gsm' (language 'jp')
    -- Executing [*21*1000@group1:4] Hangup("SIP/1002-00000003", "") in new stack
  == Spawn extension (group1, *21*1000, 4) exited non-zero on 'SIP/1002-00000003'

*CLI>   == Using SIP RTP CoS mark 5
    -- Executing [1002@group1:1] Set("SIP/1001-00000004", "temp=1000") in new stack
    -- Executing [1002@group1:2] GotoIf("SIP/1001-00000004", "1?local:outcall") in new stack
    -- Goto (group1,1002,3)
    -- Executing [1002@group1:3] GotoIf("SIP/1001-00000004", "1?sipfr:sipnofr") in new stack
    -- Goto (group1,1002,4)
[Apr 16 18:44:15] WARNING[3301]: pbx.c:3677 pbx_extension_helper: No application 'SetCallerID' for extension (group1, 1002, 4)
  == Spawn extension (group1, 1002, 4) exited non-zero on 'SIP/1001-00000004'

0
grbladesCommented:
SetCallerID is an old function which has changed in recent versions of asterisk. If you are running asterisk 1.2 or newer use the following line instead:-

exten => _1XXX,n(sipfr),Set(CALLERID(num)=${CALLERID(NUM):7})
0
AnanthahkAuthor Commented:
Great !!!!!!!!!

I have implemented Astersik 1.6.2
This code works, Now what tweaking is required if I need to do "call forward while busy" and "call fwd no answer"

Also the code has become quite complicated now, before my code was quite simpler :-), Anyway can you suggest me some good book to understand Asterisk from basics.
Appreciate your help
0
grbladesCommented:
For the other two call forward options you will need to query the ${DIALSTATUS} after making the call

${DIALSTATUS} will be one of:

    * CHANUNAVAIL : Channel unavailable (for example in sip.conf, when using qualify=, the SIP chan is unavailable)
    * BUSY : Returned busy
    * NOANSWER : No Answer (i.e SIP 480 or 604 response)
    * ANSWER : Call was answered
    * CANCEL : Call attempt cancelled (i.e user hung up before the call connected)
    * DONTCALL : Privacy manager don't call
    * TORTURE : Privacy manager torture menu
    * CONGESTION : Means Congestion, or anything else (some other error setting up the call)



http://www.asterisk.org/support contains links to various books and the support forum.
http://www.voip-info.org/wiki/view/Asterisk is the Asterisk wiki and very usefull for searching for details on the individual commands.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AnanthahkAuthor Commented:
Thanks a lot for your help, I should be able to take it from here.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IP Telephony

From novice to tech pro — start learning today.