Call state notifications
Event sockets is what you want....
Thanks Ken, it looks like Event Sockets will do the job, but I'm not sure how. I'm testing with netcat listening on port 8084, and then I've managed to connect to it by inserting this line on the dialplan: <action application="socket" data="127.0.0.1:8084 async full"/> Since I dont need to control the call but only receive notification events about the channel state changes I assume I have to send the command "myevents\n\n\" and the pass the variable socket_resume:true back, but this doesnt seem to be working. sendmsg call-command: execute execute-app-name: myevents\n\n\ socket_resume:true This is my first attempt to write an application for FS so I need some guidance. Thanks!
Rogelio, Are you trying to make a single web page that shows the status of multiple calls? If so then you probably want what we call "inbound" event socket versus the "outbound" event socket that you described below. (Inbound and outbound are from the perspective of FreeSWITCH, so when you have a dialplan with the socket app it makes an "outbound" socket connection to your program that is listening on the IP/port...) If you want to sit and watch the event socket and see all the channel state change events then I recommend a few things: #1 - read up on the event socket on the wiki, especially the event socket commands like "filter" #2 - get a feel for what events come down the pipe by using fs_cli: open fs_cli type "/log 0" to turn off logging type "/events plain all" to turn on events Just sit and watch the console. You'll be amazed (and overwhelmed) at all of the events and information that come to you. #3 - See if you can set a filter to get only the events you want. While still at the fs_cli and while watching all the events come to you, try typing this: "/filter Event-Name CHANNEL_STATE_CHANGE" That will filter out everything *except* channel state changes. Then make a call and watch the screen. Do stuff like transfers and hangups, etc. and see what the events look like. If that all seems like too much then you can cheat and just send a "show channels" every 2 seconds and parse the results. ;) Have fun! -MC On Wed, Apr 13, 2011 at 8:30 PM, Rogelio Perez <rogelio.perez@gmail.com>wrote:
Event sockets is what you want....
Thanks Ken, it looks like Event Sockets will do the job, but I'm not sure how. I'm testing with netcat listening on port 8084, and then I've managed to connect to it by inserting this line on the dialplan:
<action application="socket" data="127.0.0.1:8084 async full"/>
Since I dont need to control the call but only receive notification events about the channel state changes I assume I have to send the command "myevents\n\n\" and the pass the variable socket_resume:true back, but this doesnt seem to be working.
sendmsg call-command: execute execute-app-name: myevents\n\n\ socket_resume:true
This is my first attempt to write an application for FS so I need some guidance. Thanks!
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi Michael, This is exactly what I needed. I assumed that outbound was the way to go because FS will push the notifications to me, but now I see that inbound is more like subscribing to the events notifications. I have enough info to continue playing, thanks! Rogelio On Apr 14, 2011, at 2:12 PM, Michael Collins wrote:
Rogelio,
Are you trying to make a single web page that shows the status of multiple calls? If so then you probably want what we call "inbound" event socket versus the "outbound" event socket that you described below. (Inbound and outbound are from the perspective of FreeSWITCH, so when you have a dialplan with the socket app it makes an "outbound" socket connection to your program that is listening on the IP/port...)
If you want to sit and watch the event socket and see all the channel state change events then I recommend a few things:
#1 - read up on the event socket on the wiki, especially the event socket commands like "filter" #2 - get a feel for what events come down the pipe by using fs_cli: open fs_cli type "/log 0" to turn off logging type "/events plain all" to turn on events
Just sit and watch the console. You'll be amazed (and overwhelmed) at all of the events and information that come to you.
#3 - See if you can set a filter to get only the events you want. While still at the fs_cli and while watching all the events come to you, try typing this: "/filter Event-Name CHANNEL_STATE_CHANGE"
That will filter out everything *except* channel state changes. Then make a call and watch the screen. Do stuff like transfers and hangups, etc. and see what the events look like.
If that all seems like too much then you can cheat and just send a "show channels" every 2 seconds and parse the results. ;)
Have fun! -MC
On Wed, Apr 13, 2011 at 8:30 PM, Rogelio Perez <rogelio.perez@gmail.com> wrote:
Event sockets is what you want....
Thanks Ken, it looks like Event Sockets will do the job, but I'm not sure how. I'm testing with netcat listening on port 8084, and then I've managed to connect to it by inserting this line on the dialplan:
<action application="socket" data="127.0.0.1:8084 async full"/>
Since I dont need to control the call but only receive notification events about the channel state changes I assume I have to send the command "myevents\n\n\" and the pass the variable socket_resume:true back, but this doesnt seem to be working.
sendmsg call-command: execute execute-app-name: myevents\n\n\ socket_resume:true
This is my first attempt to write an application for FS so I need some guidance. Thanks!
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hello, I'm using mod_nibblebill to bill my calls only for leg b and heartbeats set to 'off'. After the hangup I see 3 different MySQL updates from nibblebill instead of just one. This is my dial plan: <extension name="TEST"> <condition field="destination_number" expression="^(1\d+)$"> <action application="set" data="dialed_extension=$1"/> <action application="export" data="dialed_extension=$1"/> <action application="set" data="hangup_after_bridge=true"/> <action application="set" data="continue_on_fail=true"/> <action application="bridge" data="{nibble_rate=5,nibble_account=13}sofia/gateway/xxxxxxx/$1"/> <action application="hangup"/> </condition> </extension> ...this is the MySQL log: 68080 Query select 1 68080 Query UPDATE web_account SET balance=balance-0.343372 WHERE id='13' 68080 Query select 1 68080 Query SELECT balance AS nibble_balance FROM web_account WHERE id='13' 68080 Query select 1 68080 Query UPDATE web_account SET balance=balance-0.001177 WHERE id='13' 68080 Query select 1 68080 Query SELECT balance AS nibble_balance FROM web_account WHERE id='13' 68080 Query select 1 68080 Query UPDATE web_account SET balance=balance-0.001197 WHERE id='13' 68080 Query select 1 68080 Query SELECT balance AS nibble_balance FROM web_account WHERE id='13' ...and here's the FS log: http://pastebin.freeswitch.org/16175 The xml_cdr is saved after the second update, so the nibble_total_billed is different than the real total value debited from the account balance. Is this normal? Shouldn't nibblebill just do one update after the hangup?
I've removed the on_reporting hook: http://jira.freeswitch.org/browse/FS-2890 this should at least get rid of the final update and should remove the small difference between nibblebill numbers and cdrs. On Mon, Apr 25, 2011 at 11:24 PM, Rogelio Perez <rogelio.perez@gmail.com> wrote:
Hello, I'm using mod_nibblebill to bill my calls only for leg b and heartbeats set to 'off'. After the hangup I see 3 different MySQL updates from nibblebill instead of just one. This is my dial plan: <extension name="TEST"> <condition field="destination_number" expression="^(1\d+)$"> <action application="set" data="dialed_extension=$1"/> <action application="export" data="dialed_extension=$1"/> <action application="set" data="hangup_after_bridge=true"/> <action application="set" data="continue_on_fail=true"/> <action application="bridge" data="{nibble_rate=5,nibble_account=13}sofia/gateway/xxxxxxx/$1"/> <action application="hangup"/> </condition> </extension> ...this is the MySQL log: 68080 Query select 1 68080 Query UPDATE web_account SET balance=balance-0.343372 WHERE id='13' 68080 Query select 1 68080 Query SELECT balance AS nibble_balance FROM web_account WHERE id='13' 68080 Query select 1 68080 Query UPDATE web_account SET balance=balance-0.001177 WHERE id='13' 68080 Query select 1 68080 Query SELECT balance AS nibble_balance FROM web_account WHERE id='13' 68080 Query select 1 68080 Query UPDATE web_account SET balance=balance-0.001197 WHERE id='13' 68080 Query select 1 68080 Query SELECT balance AS nibble_balance FROM web_account WHERE id='13'
...and here's the FS log: http://pastebin.freeswitch.org/16175 The xml_cdr is saved after the second update, so the nibble_total_billed is different than the real total value debited from the account balance. Is this normal? Shouldn't nibblebill just do one update after the hangup?
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- -Rupa
Hello, I'm using mod_nibblebill to bill my calls only for leg b and heartbeats set to 'off'. After the hangup I see 3 different MySQL updates from nibblebill instead of just one. This is my dial plan: <extension name="TEST"> <condition field="destination_number" expression="^(1\d+)$"> <action application="set" data="dialed_extension=$1"/> <action application="export" data="dialed_extension=$1"/> <action application="set" data="hangup_after_bridge=true"/> <action application="set" data="continue_on_fail=true"/> <action application="bridge" data="{nibble_rate=5,nibble_account=13}sofia/gateway/xxxxxxx/$1"/> <action application="hangup"/> </condition> </extension> ...this is the MySQL log: 68080 Query select 1 68080 Query UPDATE web_account SET balance=balance-0.343372 WHERE id='13' 68080 Query select 1 68080 Query SELECT balance AS nibble_balance FROM web_account WHERE id='13' 68080 Query select 1 68080 Query UPDATE web_account SET balance=balance-0.001177 WHERE id='13' 68080 Query select 1 68080 Query SELECT balance AS nibble_balance FROM web_account WHERE id='13' 68080 Query select 1 68080 Query UPDATE web_account SET balance=balance-0.001197 WHERE id='13' 68080 Query select 1 68080 Query SELECT balance AS nibble_balance FROM web_account WHERE id='13' ...and here's the FS log: http://pastebin.freeswitch.org/16175 The xml_cdr is saved after the second update, so the nibble_total_billed is different than the real total value debited from the account balance. Is this normal? Shouldn't nibblebill just do one update after the hangup?
participants (3)
-
Michael Collins
-
Rogelio Perez
-
Rupa Schomaker