-
Notifications
You must be signed in to change notification settings - Fork 7
pchero/asterisk-zmq
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ZMQ manager Author: Sungtae Kim <pchero21@gmail.com> INFO: - This moudule aims to replicate asterisk manager interface using zmq and json. - For now, it just support any json-type of message pass to ami. - This module has two sockets. One is for action&reply, and the other one is for eventy notify. - It is asterisk-20.x compatible. For asterisk-13.x compatible, please use the asterisk-13 branch. DESCRIPTION: - ZMQ manager uses 2 zmq sockets. - zmq_cmd, zmq_evt. - Default address is (addr_cmd=tcp://*:967, addr_evt=tcp://*:968) - zmq_cmd designed for REQ-REP pattern. (For AMI Action) - zmq_evt designed for PUB-SUB pattern. (For AMI Event) - AMI should be enabled.(MUST) - If AMI disabled, no event message would be received.(only Action/Response working) - zmq_cmd send message as an json_array. - zmq_evt send message as an json_object. DEPENDENCIES: - zmq(zeromq-3.2.5) - compiled Asterisk with json support. REFERENCE: - Flavio [FlaPer87] Percoco Premoli <flaper87@flaper87.org> BUILDING: - cd asterisk-zmq/ && make INSTALLING: - cp build/zmq_manager.so ASTERISK_INSTALL_PATH/lib/asterisk/modules/ USAGE: - Create a config file. See conf/zmq_manager.conf -- cp conf/zmq_manager.conf /etc/asterisk - Add: load => res_zmq_manager.so to the modules.conf file -- echo "load => res_zmq_manager.so" >> /etc/asterisk/modules.conf - AMI enable(MUST) -- edit /etc/asterisk/manager.conf. -- change "enabled = no" to "enabled = yes" - See samples. Asterisk CLI HELP: - Asterisk*CLI> zmq manager status [cmd address: tcp://*:967] [evt address: tcp://*:968] SAMPLES: - $ python samples/evt_receiver.py // Receive Asterisk event script. - $ python samples/cmd_sippeers.py.py - ... TEST: - Send AMI message in json style, to tcp://localhost967 --Send {"Action": "SIPpeers"} -- It will reply AMI response in json style.(Json array) [ { "Response":"Success", "EventList":"start", "Message":"Peer status list will follow" }, { "IPport":"44151", "AutoComedia":"no", "Dynamic":"yes", "TextSupport":"no", "Event":"PeerEntry", "ChanObjectType":"peer", "Status":"Unmonitored", "Channeltype":"SIP", "AutoForcerport":"yes", "Comedia":"no", "VideoSupport":"no", "IPaddress":"127.0.0.1", "ObjectName":"test-01", "Forcerport":"no", "ACL":"no", "RealtimeDevice":"no", "Description":"" }, { "IPport":"0", "AutoComedia":"no", "Dynamic":"yes", "TextSupport":"no", "Event":"PeerEntry", "ChanObjectType":"peer", "Status":"Unmonitored", "Channeltype":"SIP", "AutoForcerport":"yes", "Comedia":"no", "VideoSupport":"no", "IPaddress":"-none-", "ObjectName":"test-02", "Forcerport":"no", "ACL":"no", "RealtimeDevice":"no", "Description":"" }, { "IPport":"0", "AutoComedia":"no", "Dynamic":"yes", "TextSupport":"no", "Event":"PeerEntry", "ChanObjectType":"peer", "Status":"Unmonitored", "Channeltype":"SIP", "AutoForcerport":"yes", "Comedia":"no", "VideoSupport":"no", "IPaddress":"-none-", "ObjectName":"test-03", "Forcerport":"no", "ACL":"no", "RealtimeDevice":"no", "Description":"" }, { "Event":"PeerlistComplete", "ListItems":"3", "EventList":"Complete" } ] -- Send {"Action":"SIPShowPeer","Peer":"test-01"} -- Response [ { "SIP-Sess-Expires":"1800", "LastMsgsSent":"0", "SecretExist":"Y", "Parkinglot":"", "SIP-Forcerport":"a", "SIP-DirectMedia":"Y", "Named Pickupgroup":"", "SIP-AuthInsecure":"no", "Busy-level":"0", "Named Callgroup":"", "ACL":"N", "Dynamic":"Y", "Response":"Success", "AMAflags":"Unknown", "RemoteSecretExist":"N", "Default-addr-port":"0", "SIP-UserPhone":"N", "MaxCallBR":"384 kbps", "VoiceMailbox":"", "Channeltype":"SIP", "QualifyFreq":"60000 ms", "SIP-RTP-Engine":"asterisk", "SIP-CanReinvite":"Y", "Language":"", "Callgroup":"", "Context":"public", "ChanObjectType":"peer", "CID-CallingPres":"Presentation Allowed, Not Screened", "Default-addr-IP":"(null)", "ToneZone":"<Not set>", "ToHost":"", "SIP-Sess-Refresh":"uas", "SIP-Useragent":"", "TransferMode":"open", "SIP-T.38MaxDtgrm":"4294967295", "SIP-DTMFmode":"rfc2833", "ObjectName":"test-01", "MD5SecretExist":"N", "Address-IP":"127.0.0.1", "Call-limit":"0", "Maxforwards":"0", "Pickupgroup":"", "MOHSuggest":"", "SIP-VideoSupport":"N", "Description":"", "Callerid":"\"\" <>", "SIP-Comedia":"N", "Default-Username":"test-01", "RegExpire":"604 seconds", "SIP-Encryption":"N", "SIP-PromiscRedir":"N", "SIP-Sess-Timers":"Accept", "SIP-TextSupport":"N", "Reg-Contact":"sip:test-01@127.0.0.1:44151", "SIP-T.38Support":"N", "SIP-T.38EC":"Unknown", "SIP-Sess-Min":"90", "Address-Port":"44151", "Codecs":"(ulaw|alaw|gsm|h263)", "Status":"Unmonitored", "SIP-Use-Reason-Header":"N" } ] LICENSING: - BSD License
About
zmq/json support asterisk AMI module. (zeromq, 0MQ)
Resources
Stars
Watchers
Forks
Packages 0
No packages published