receiving RFC2833 DTMF in Perl ESL script while Outbound calling and executing a lua script - perl

I have written a Perl ESL script which places an outbound call and bridges that together with a lua script which does some tts with flite.
This worked well with SIP INFO DTMF. But since our SIP Provider disables SIP INFO and switched to RFC2833 the ESL script no longer gets DTMF events. In the freeswitch console.
I see all the DTMF events.
I connect to all events with:
$con->events("plain","ALL");
But don't get any DTMF event all other events I get.
Any Idea?

Not sure about Perl, but you can use something like this from LUA:
digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, terminators , sounds_file", "", "\\d+")
That will collect the DTMF digits that are passed to it and you can call it from your dialplan such as:
<action application="lua" data="get_dtmf.lua" />
You can iterate through the "digits" to do what you need to do.

Related

How to fix the missing BLINDTRANSFER and ATTENDEDTRANSFER log entries in the queue_log file?

I write a wallboard for asterisk queue system. The document says that when a call is transferred away by an agent an ATTENDEDTRANSFER (or BLINDTRANSFER) event log should be added to the queue_log file automatically. Unfortunately there is no line for any transferred calls in the log file (queue_log in my case). Is there any setting to be changed to let the system to log them properly ?
When I check the CEL files, I see the transfer logs. So the system is logging correctly for CEL but not for queue_log.
I tried to transfer the call to another agent, to an IVR and to another user who is not an agent for any queue. The result is the same, no log for the transfer process.
Any suggestions ?
I use the following:
Asterisk Version: 13.22.0
Freepbx 14.0.5.25
All trunks and clients are connected via SIP
If your phone do transfer via internal features - no log entries.
You have parse AMI events for needed info.
Write your own queue wallboard is VERY hard task. Queue module have really alot of issues.
Can recommend read some already written modules like https://www.asternic.net or queuemetric

How to enter an option during voice calls using at commands

I've been using a sim900 module to replicate many of the functions found in a basic cellphones for an embedded project. I've been successful with most functions with the exception of entering options during a voice call. I am actually looking for a generic solution (e.g. GSM 07.07 etc.) although the GSM/GPRS Module I'm using is the sim900.
Scenario: I initiate a call using ATD<number>; ,then automated voice asks me to dial "1" for an option. How do I send the "1"?
I've search high and low for an answer. I've been through the AT command manual over and over again. Please help.
Very good start in using the official GSM specification, although I want to note that 07.07 has been superseded by 27.007 a very long time ago, and you should use that document (or 27.005 if relevant).
I initially expected there to be two ways of achieving this, dial string modifiers or DTMF command, but I looking up the dial string in the 27.007 specification I do not find the p (pause) modifier1 I was expecting, and nearest thing, the W (wait) modifier is ignored and only included for compatibility.
Sending 0 through 9, A through D, * and # during a call is done using DTMF, although in a GSM network this is signalled separately out of band rather than sending in-band analogue tones. There is a specific command for sending DTMF tones called AT+VTS (with a horrible syntax). So that command is the answer to you question. Invoke it either from online command mode or from another serial connection.
1 The reason I was expecting a p modifier to exist is that I am able to enter one in phone book entries, e.g. `"12345678p123" which will dial 12345678, wait for the connection to be established and then send 123 as DTMF tones. But this is then obviously something (only) the user interface voice call handler manages and not the AT command handler.

script to parse a text file

Any help is greatly appreciated. I have a Cisco voice gateway that I connect to with SSH and can send a command to get all the current calls on the gateway. I'm trying to automate this so that I can pull out this information and display it on a big screen TV in an area that needs to see the current active calls at any given moment.
I've got the automated part down already, it will connect to the gateway and pull out the command results in a text file. Sample output is below.
I am trying to find a way, perhaps with powershell, or something else, to parse this text file, and just extract two pieces of information: calling# and called# so I can display it in a web page. The problem is that I need to remove a lot of the headers and stuff and also, the number of callers is not fixed, there can be 0 callers, or 10+ calls at any given time.
Any suggestions on how I may be able to automate this?
Sample output:
Total SIP call legs:4, User Agent Client:2, User Agent Server:2
SIP UAC CALL INFO
No. CallId Calling# Called# RmtSignalIP RmtMediaIP
dstCallId SIPState SIPSubState
========================================================================================================================================
1 14780 5835 6000 172.30.1.11 172.30.1.14
14779 STATE_ACTIVE SUBSTATE_NONE
2 14784 5820 6000 172.30.1.11 172.30.1.14
14783 STATE_ACTIVE SUBSTATE_NONE
Number of SIP User Agent Client(UAC) calls: 2
SIP UAS CALL INFO
No. CallId Calling# Called# RmtSignalIP RmtMediaIP
dstCallId SIPState SIPSubState
========================================================================================================================================
1 14779 5835 5678 172.30.1.12 172.30.1.29
14780 STATE_ACTIVE SUBSTATE_NONE
2 14783 5820 5678 172.30.1.12 172.30.1.24
14784 STATE_ACTIVE SUBSTATE_NONE
Number of SIP User Agent Server(UAS) calls: 2
You can use get-content and interate through it, starting with "======" and ended with "Number of SIP User Agents .."
All between those lines is your data, where you Need to do some more parsing (trim spaces etc)

Test Harness for a Clojure TCP Client

I'm writing a TCP client to connect, send messages to, and read responses from nodes on a busy network. I do not have access to code running on those nodes, so I have to sculpt the TCP messages I send out over the wire very carefully.
I've decided that I'm going to gather a bunch of live TCP data off of the network and use that as the basis for testing my client - given these input parameters, make sure that the transmitted binary renders into the hex I expect to see.
At this point I'm about to either fire up Wireshark and figure out how to filter for the packets that I'm sending or implement a really simple TCP server that waits for connections, spits the transmitted binary to disk (maybe processed to hex) and then test that I'm sending what I expect to send; neither of which feel like robust or professional solutions.
So: how would you recommend setting up a test harness for a TCP client to verify the right hex messages are coming out?
You should check out aleph for tcp and gloss for protocols. here is a tutorial and an example.
a simple tcp echo-server could be:
(defn echo-handler [ch client-info]
(siphon ch ch)) ;; a simple echo handler
(defn start-server [] (start-tcp-server
echo-handler
{:port 9997}))
(start-server)
gloss will be very useful at spitting the received messages either as hex dump or as values if you encode your protocol in it and use "decode".

Openfire sends empty (without stamp attr) jabber:x:delay extension to smack

I receive offline message from openfire server, but it contains empty jabber:x:delay extension.
The message I receive is:
<message id="qU7N8-64" to="ac1#server.jj.ru" from="ac2#server.jj.ru/4847791" type="chat">
<body>test message</body>
<delay xmlns="urn:xmpp:delay"></delay>
<x xmlns="jabber:x:delay"></x>
</message>
This message I receive with smack library.
But when I connect to openfire with Miranda IM, openfire sends extension jabber:x:delay with data.
Why openfire sends empty jabber:x:delay only to smack library?
Add this line after connection.
ProviderManager.getInstance()addExtensionProvider("x","jabber:x:delay", new DelayInformationProvider());
Openfire doesn't do anything different since it doesn't know (or care) what client is connected. The packet you are showing is very peculiar, since it contains both the legacy and current versions of Delayed Delivery, but with missing required attributes in both.
Try running with VM argument -Dsmack.debugEnabled=true set. Then check the incoming raw packets for the actual message content. There is most likely one of 2 things happening.
The time is missing, so Miranda is compensating by populating it with some default value, like current date.
The time format is not according to spec, so the parser in Smack is omitting it.