[Freeswitch-dev] Hook-Flash passthrough/translation FXS->FXO
Hi Guys, [In short: can someone knowledgeable confirm the small patch below for hook-flash support uses correct locking? Is there a better approach?] I am taking 16 CENTREX (analog) lines from our telco and passing each through a Freeswitch instance to 16 analog handsets in order to enable call recording. I'm using a Xorcom device with 16 FXS and 16 FXO ports and I'm basically bridging these ports together one-to-one. Since this setup exists side-by-side with 100 "unadorned" CENTREX lines it is important that the clerks don't have to learn a second way of transferring calls for some percentage of the stations. Calls on CENTREX lines are transferred by pressing <hook flash> # <digit> <digit> (i.e. <flash>#42) DTMF digits can be made to pass through in-band just fine (modulo a feedback issue that I'm still working on but have patched around for now) but the hook flash support is only half-way present. Freeswitch already supports the artificial DTMF digit "F" will allow you to queue it on a channel to effect a hook flash. It does not yet allow detection of the hook-flash on the FXS to result in digit "F" being queued. I'm running with the following (hack alert) patch to make this work. I'm considering tying this to a knob called flash2dtmf or similar. ----8<----8<----8<----8<----8<----8<----8<---- @@ -1746,6 +1750,31 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxs_signal) zap_set_flag_locked(sigmsg->channel, ZAP_CHANNEL_HOLD); zap_set_state_locked(sigmsg->channel, ZAP_CHANNEL_STATE_DIALTONE); } + } else { + switch_core_session_t *session; + switch_dtmf_t _dtmf = { 'F', SWITCH_DEFAULT_DTMF_DURATION }; + + zap_log(ZAP_LOG_DEBUG, "HERE BE CUSTOM FLASH HANDLING...\n"); + + if ((session = zap_channel_get_session(sigmsg->channel, 0))) { + + zap_log(ZAP_LOG_DEBUG, "Got a session...\n"); + + channel = switch_core_session_get_channel(session); + + zap_log(ZAP_LOG_DEBUG, "Got a channel...\n"); + + switch_channel_queue_dtmf(channel, &_dtmf); + + zap_log(ZAP_LOG_DEBUG, "Queued DTMF [F]...\n"); + + switch_core_session_rwunlock(session); + + zap_log(ZAP_LOG_DEBUG, "Unlocked session...\n"); + } + + zap_log(ZAP_LOG_DEBUG, "END OF CUSTOM FLASH HANDLING.\n"); + } } ----8<----8<----8<----8<----8<----8<----8<---- A log excerpt of a clerk taking an inbound call (14sec) and then using hook-flash to transfer the call to extension #42: ----8<----8<----8<----8<----8<----8<----8<---- 2010-06-15 18:12:33.435334 [NOTICE] mod_openzap.c:1612 Channel [OpenZAP/1:1/] has been answered 2010-06-15 18:12:33.451333 [DEBUG] switch_core_codec.c:146 OpenZAP/3:1/1001 Restore previous codec PCMU:0. 2010-06-15 18:12:33.451333 [DEBUG] switch_ivr_originate.c:3230 Originate Resulted in Success: [OpenZAP/1:1/] 2010-06-15 18:12:33.451333 [DEBUG] switch_ivr_originate.c:3230 Originate Resulted in Success: [OpenZAP/1:1/] 2010-06-15 18:12:33.451333 [DEBUG] switch_core_session.c:643 Send signal OpenZAP/1:1/ [BREAK] 2010-06-15 18:12:33.451333 [DEBUG] switch_core_session.c:643 Send signal OpenZAP/3:1/1001 [BREAK] 2010-06-15 18:12:33.451333 [DEBUG] switch_ivr_bridge.c:1182 (OpenZAP/1:1/) State Change CS_CONSUME_MEDIA -> CS_EXCHANGE_ MEDIA 2010-06-15 18:12:33.451333 [DEBUG] switch_core_session.c:1023 Send signal OpenZAP/1:1/ [BREAK] 2010-06-15 18:12:33.451333 [DEBUG] switch_core_state_machine.c:314 (OpenZAP/1:1/) Running State Change CS_EXCHANGE_MEDIA 2010-06-15 18:12:33.451333 [DEBUG] switch_core_state_machine.c:351 (OpenZAP/1:1/) State EXCHANGE_MEDIA 2010-06-15 18:12:33.451333 [DEBUG] mod_openzap.c:595 CHANNEL EXCHANGE_MEDIA 2010-06-15 18:12:33.455333 [DEBUG] switch_core_session.c:704 Send signal OpenZAP/1:1/ [BREAK] 2010-06-15 18:12:33.455333 [DEBUG] switch_core_session.c:704 Send signal OpenZAP/3:1/1001 [BREAK] 2010-06-15 18:12:47.543864 [DEBUG] ozmod_analog.c:801 EVENT [FLASH][1:1] STATE [UP] 2010-06-15 18:12:47.543864 [DEBUG] mod_openzap.c:1605 got FXS sig [FLASH] 2010-06-15 18:12:47.543864 [DEBUG] mod_openzap.c:1757 HERE BE CUSTOM FLASH HANDLING... 2010-06-15 18:12:47.543864 [DEBUG] mod_openzap.c:1761 Got a session... 2010-06-15 18:12:47.543864 [DEBUG] mod_openzap.c:1765 Got a channel... 2010-06-15 18:12:47.543864 [DEBUG] mod_openzap.c:1769 Queued DTMF [F]... 2010-06-15 18:12:47.543864 [DEBUG] mod_openzap.c:1773 Unlocked session... 2010-06-15 18:12:47.543864 [DEBUG] mod_openzap.c:1776 END OF CUSTOM FLASH HANDLING. 2010-06-15 18:12:47.570863 [DEBUG] zap_io.c:2062 3:1 GENERATE DTMF [F] 2010-06-15 18:12:49.554796 [DEBUG] mod_openzap.c:724 queue DTMF [#] 2010-06-15 18:12:49.570795 [DEBUG] zap_io.c:2062 3:1 GENERATE DTMF [#] 2010-06-15 18:12:49.774789 [DEBUG] mod_openzap.c:784 Dropping frame! (write not ready) 2010-06-15 18:12:50.194774 [DEBUG] mod_openzap.c:724 queue DTMF [4] 2010-06-15 18:12:50.230773 [DEBUG] zap_io.c:2062 3:1 GENERATE DTMF [4] 2010-06-15 18:12:50.314771 [DEBUG] mod_openzap.c:722 Ignoring DTMF [4] on FXO port 3:1 2010-06-15 18:12:50.414767 [DEBUG] mod_openzap.c:784 Dropping frame! (write not ready) 2010-06-15 18:12:50.794755 [DEBUG] mod_openzap.c:724 queue DTMF [2] 2010-06-15 18:12:50.830753 [DEBUG] zap_io.c:2062 3:1 GENERATE DTMF [2] 2010-06-15 18:12:50.915750 [DEBUG] mod_openzap.c:722 Ignoring DTMF [2] on FXO port 3:1 2010-06-15 18:12:51.013748 [DEBUG] mod_openzap.c:784 Dropping frame! (write not ready) 2010-06-15 18:13:29.244471 [DEBUG] ozmod_analog.c:801 EVENT [ONHOOK][1:1] STATE [UP] 2010-06-15 18:13:29.244471 [DEBUG] ozmod_analog.c:837 Changing state on 1:1 from UP to DOWN 2010-06-15 18:13:29.262471 [DEBUG] ozmod_analog.c:463 Executing state handler on 1:1 for DOWN 2010-06-15 18:13:29.262471 [DEBUG] mod_openzap.c:1605 got FXS sig [STOP] 2010-06-15 18:13:29.262471 [DEBUG] switch_channel.c:2257 (OpenZAP/1:1/) Callstate Change ACTIVE -> HANGUP 2010-06-15 18:13:29.262471 [NOTICE] mod_openzap.c:1696 Hangup OpenZAP/1:1/ [CS_EXCHANGE_MEDIA] [NORMAL_CLEARING] 2010-06-15 18:13:29.262471 [DEBUG] switch_channel.c:2273 Send signal OpenZAP/1:1/ [KILL] 2010-06-15 18:13:29.262471 [DEBUG] switch_core_session.c:1023 Send signal OpenZAP/1:1/ [BREAK] ----8<----8<----8<----8<----8<----8<----8<---- Cheers, -Slim -- Jeroen C. "Slim" van Gelderen Olympic Sports Data Services Email: jeroeng@thegreek.com Phone: +1 876 953 6182 x128
Please put this on http://jira.freeswitch.org so its not lost. /b On Jun 17, 2010, at 6:06 PM, Jeroen C. van Gelderen wrote:
[In short: can someone knowledgeable confirm the small patch below for hook-flash support uses correct locking? Is there a better approach?]
Also, if you are going to post that to JIRA, and since this is a new feature, you must make the patch for FreeTDM (libs/freetdm) and start using FreeTDM instead of the deprecated openzap. If there is a problem with FreeTDM I am open to spend time fixing and improving it, not so much for openzap. Moises Silva Senior Software Engineer Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON L3R 9T3 Canada t. 1 905 474 1990 x 128 | e. moy@sangoma.com On Thu, Jun 17, 2010 at 7:10 PM, Brian West <brian@freeswitch.org> wrote:
Please put this on http://jira.freeswitch.org so its not lost.
/b
On Jun 17, 2010, at 6:06 PM, Jeroen C. van Gelderen wrote:
[In short: can someone knowledgeable confirm the small patch below for hook-flash support uses correct locking? Is there a better approach?]
_______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
Hi Moises, Thanks for the heads up. I wasnt aware that OpenZap was deprecated and FreeTDM its designated replacement. I will try to convert my system from OpenZap to FreeTDM but since I had to put this setup in production to replaced failed equipment it may take me a little while. Is this something we'd want to patch in both OpenZap and FreeTDM or just in the latter? Cheers, -Slim -- Jeroen C. "Slim" van Gelderen Olympic Sports Data Services Email: jeroeng@thegreek.com Phone: +1 876 953 6182 x128 ________________________________________ From: freeswitch-dev-bounces@lists.freeswitch.org [mailto:freeswitch-dev-bounces@lists.freeswitch.org] On Behalf Of Moises Silva Sent: Thursday, June 17, 2010 20:57 To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] Hook-Flash passthrough/translation FXS->FXO Also, if you are going to post that to JIRA, and since this is a new feature, you must make the patch for FreeTDM (libs/freetdm) and start using FreeTDM instead of the deprecated openzap. If there is a problem with FreeTDM I am open to spend time fixing and improving it, not so much for openzap. Moises Silva Senior Software Engineer Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON L3R 9T3 Canada t. 1 905 474 1990 x 128 | e. moy@sangoma.com On Thu, Jun 17, 2010 at 7:10 PM, Brian West <brian@freeswitch.org> wrote: Please put this on http://jira.freeswitch.org so its not lost. /b On Jun 17, 2010, at 6:06 PM, Jeroen C. van Gelderen wrote:
[In short: can someone knowledgeable confirm the small patch below for hook-flash support uses correct locking? Is there a better approach?]
_______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists..freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
Hi Slim, Definitely this is something we only want in FreeTDM. Moises Silva Senior Software Engineer Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON L3R 9T3 Canada t. 1 905 474 1990 x 128 | e. moy@sangoma.com On Sat, Jun 19, 2010 at 12:57 PM, Jeroen C. van Gelderen < jeroeng@thegreek.com> wrote:
Hi Moises,
Thanks for the heads up. I wasn’t aware that OpenZap was deprecated and FreeTDM its designated replacement.
I will try to convert my system from OpenZap to FreeTDM but since I had to put this setup in production to replaced failed equipment it may take me a little while.
Is this something we'd want to patch in both OpenZap and FreeTDM or just in the latter?
Cheers, -Slim -- Jeroen C. "Slim" van Gelderen Olympic Sports Data Services Email: jeroeng@thegreek.com Phone: +1 876 953 6182 x128 ________________________________________ From: freeswitch-dev-bounces@lists.freeswitch.org [mailto:freeswitch-dev-bounces@lists.freeswitch.org] On Behalf Of Moises Silva Sent: Thursday, June 17, 2010 20:57 To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] Hook-Flash passthrough/translation FXS->FXO
Also, if you are going to post that to JIRA, and since this is a new feature, you must make the patch for FreeTDM (libs/freetdm) and start using FreeTDM instead of the deprecated openzap.
If there is a problem with FreeTDM I am open to spend time fixing and improving it, not so much for openzap.
Moises Silva Senior Software Engineer Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON L3R 9T3 Canada t. 1 905 474 1990 x 128 | e. moy@sangoma.com
On Thu, Jun 17, 2010 at 7:10 PM, Brian West <brian@freeswitch.org> wrote: Please put this on http://jira.freeswitch.org so its not lost.
/b
On Jun 17, 2010, at 6:06 PM, Jeroen C. van Gelderen wrote:
[In short: can someone knowledgeable confirm the small patch below for hook-flash support uses correct locking? Is there a better approach?]
_______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists..freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
_______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
participants (3)
-
Brian West
-
Jeroen C. van Gelderen
-
Moises Silva