CentOS 5.x, FreePBX 2.9, Asterisk 1.8.14.1
I’ve been working on distributed device states via XMPP and have 99% successfully hacked it in. Currently, it works as I need:
- place a call and the custom dev state is distributed via jabber
- once the call is complete the custom dev state is distributed via jabber
Example:
-- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/200-00000019", "0?bypass,1") in new stack
-- Executing [s@macro-dialout-trunk:19] GotoIf("SIP/200-00000019", "0?customtrunk") in new stack
-- Executing [s@macro-dialout-trunk:20] Set("SIP/200-00000019", "DEVICE_STATE(Custom:JS-DAHDI/g0)=INUSE") in new stack
-- Executing [s@macro-dialout-trunk:21] Dial("SIP/200-00000019", "DAHDI/g0/1555,300,") in new stack
-- Called DAHDI/g0/1555
-- DAHDI/1-1 answered SIP/200-00000019
-- Executing [h@macro-dialout-trunk:1] Macro("SIP/200-00000019", "hangupcall,") in new stack
-- Executing [s@macro-hangupcall:1] Set("SIP/200-00000019", "DEVICE_STATE(Custom:DAHDI/g0)=NOT_INUSE") in new stack
== Extension Changed DAHDIg0[ext-local-custom] new state Idle for Notify User 300
== Extension Changed DAHDIg0[ext-local-custom] new state Idle for Notify User 301
– Executing [s@macro-hangupcall:2] GotoIf(“SIP/200-00000019”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,4)
– Executing [s@macro-hangupcall:4] Hangup(“SIP/200-00000019”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/200-00000019’ in macro ‘hangupcall’
== Spawn extension (macro-dialout-trunk, h, 1) exited non-zero on ‘SIP/200-00000019’
– Hanging up on ‘DAHDI/1-1’
– Hungup ‘DAHDI/1-1’
== Spawn extension (macro-dialout-trunk, s, 21) exited non-zero on ‘SIP/200-00000019’ in macro ‘dialout-trunk’
== Spawn extension (from-internal, 1555, 5) exited non-zero on ‘SIP/200-00000019’
That’s GREAT however, when a call is placed and the line is hung up before the device enters the answered state, the custom devstate is not triggered to set NOT_INUSE.
Example:
-- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/200-00000018", "0?bypass,1") in new stack
-- Executing [s@macro-dialout-trunk:19] GotoIf("SIP/200-00000018", "0?customtrunk") in new stack
-- Executing [s@macro-dialout-trunk:20] Set("SIP/200-00000018", "DEVICE_STATE(Custom:DAHDI/g0)=INUSE") in new stack
== Extension Changed DAHDIg0[ext-local-custom] new state InUse for Notify User 300
== Extension Changed DAHDIg0[ext-local-custom] new state InUse for Notify User 301
– Executing [s@macro-dialout-trunk:21] Dial(“SIP/200-00000018”, “DAHDI/g0/1555,300,”) in new stack
– Called DAHDI/g0/1555
– Hanging up on ‘DAHDI/1-1’
– Hungup ‘DAHDI/1-1’
== Spawn extension (macro-dialout-trunk, s, 21) exited non-zero on ‘SIP/200-00000018’ in macro ‘dialout-trunk’
== Spawn extension (from-internal, 1555, 5) exited non-zero on ‘SIP/200-00000018’
– Executing [h@from-internal:1] Hangup(“SIP/200-00000018”, “”) in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/200-00000018’
I’ve plugged the call into various places in core/functions.inc.php to no avail; macro-dialout-trunk, macro-hangupcall, macro-hangupcall-custom, and others. I can’t for the life of me figure out the magic.
Here is the current macro-hangupcall from “dialplan show”
===================================================
[ Context ‘macro-hangupcall’ created by ‘pbx_config’ ]
‘s’ => 1. Set(DEVICE_STATE(Custom:${OUT_${DIAL_TRUNK}})=NOT_INUSE) [pbx_config]
2. GotoIf($["${USE_CONFIRMATION}"="" | “${RINGGROUP_INDEX}”="" | “${CHANNEL}”!="${UNIQCHAN}"]?theend) [pbx_config]
[delrgi] 3. Noop(Deleting: RG/${RINGGROUP_INDEX}/${CHANNEL} ${DB_DELETE(RG/${RINGGROUP_INDEX}/${CHANNEL})}) [pbx_config]
[theend] 4. Hangup() [pbx_config]
Include => ‘macro-hangupcall-custom’ [pbx_config]
It seems to me (yes I am a newb) that I need to add the call to the context “from-intermal”. I’ve tried adding from-internal-xfer because that’s the only context that contains Macro(hangupcall) but I’m missing something.
I’ve been working on this for a couple weeks now and I’m out of ideas. I’d really appreciate some help here. Hopefully this problem can be resolved!