user3850712
user3850712

Reputation: 123

Asterisk Transfer call to next extension if previous INUSE

I am trying to transfer call to next extension if previous is using (INUSE) or call is in progress. I tried to use EXTENSION_STATE(extension[@context]) to find the status as follow:

[sales]
exten => s,1,Dial(SIP/123)
exten => s,n,GotoIf($["${EXTENSION_STATE(123)}"="INUSE"]?passed:failed)
exten => s,n(passed),Dial(SIP/124)
exten => s,n(failed),Hangup();if other

But wasn't successful. How can I do that?

Upvotes: 1

Views: 529

Answers (2)

Jibon
Jibon

Reputation: 342

Try this:

[sales]
exten => s,1,Set(GROUP()=OUTBOUND_GROUP)
exten => s,2,GotoIf($[ ${GROUP_COUNT()} > 1 ]?try1:try2)
exten => s,3(try1),Dial(SIP/124)
exten => s,4(try2),Dial(SIP/123)

Use GROUP_COUNT() instead of EXTENSION_STATE()

Upvotes: 2

miken32
miken32

Reputation: 42751

The EXTENSION_STATE() function only works on hinted extensions. Make sure you're adding a hint for the extension in extensions.conf. Something like:

[default]
exten => 123,hint,SIP/123

Details: http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/DeviceStates_id265377.html

Upvotes: 1

Related Questions