-
Notifications
You must be signed in to change notification settings - Fork 7
/
README
executable file
·208 lines (187 loc) · 5.44 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
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