[Asterisk-Users] My Boss wants background music!!!!
Bill Seddon
bill.seddon at lyquidity.com
Sat Dec 18 15:42:08 MST 2004
<<Care to share a trivial example with us?>>
Sure. Here's a how-to. If you'd like a working example, let me know.
Open a TCP connection to * either directly of via, say the sampleproxy.pl
example (http://www.popvox.com/simpleproxy.pl).
Login using the manager API by sending the text string on the connection:
"Action: login\n\n"
After this, that trick is to monitor "events" from *. Asterisk will send
events to all manager connections.
Events will arrive as text on the connection in the form:
"Event: <some event type>\n<some event text>\n\n"
The event text will contain event type specific information in the format:
"<field>: <value>\n"
For example:
"Event: Newstate"
"Channel: SIP\1002-1a23"
You can monitor "Newstate" events to review the state of a call to an
extension (channel). For example it might be "ringing" or "dialled".
* will send a "Event: Link" event when a call is answered and an " Event:
Unlink" event when the call is terminated. Eventually * will send "Event:
Down" indicating that the call channel is on-hook.
You can download an application that illustrates this functionality and is
written in C# from:
http://www.yottadot.org/download.php?op=viewsdownload&sid=10
There examples of playing streamed music in C# such as:
http://www.codeproject.com/cs/media/nbass.asp
Bill Seddon
More information about the asterisk-users
mailing list