Add the ability to continue and originate using priority labels.
[asterisk/asterisk.git] / rest-api / api-docs / channels.json
1 {
2         "_copyright": "Copyright (C) 2012 - 2013, Digium, Inc.",
3         "_author": "David M. Lee, II <dlee@digium.com>",
4         "_svn_revision": "$Revision$",
5         "apiVersion": "1.6.0",
6         "swaggerVersion": "1.1",
7         "basePath": "http://localhost:8088/ari",
8         "resourcePath": "/api-docs/channels.{format}",
9         "apis": [
10                 {
11                         "path": "/channels",
12                         "description": "Active channels",
13                         "operations": [
14                                 {
15                                         "httpMethod": "GET",
16                                         "summary": "List all active channels in Asterisk.",
17                                         "nickname": "list",
18                                         "responseClass": "List[Channel]"
19                                 },
20                                 {
21                                         "httpMethod": "POST",
22                                         "summary": "Create a new channel (originate).",
23                                         "notes": "The new channel is created immediately and a snapshot of it returned. If a Stasis application is provided it will be automatically subscribed to the originated channel for further events and updates.",
24                                         "nickname": "originate",
25                                         "responseClass": "Channel",
26                                         "parameters": [
27                                                 {
28                                                         "name": "endpoint",
29                                                         "description": "Endpoint to call.",
30                                                         "paramType": "query",
31                                                         "required": true,
32                                                         "allowMultiple": false,
33                                                         "dataType": "string"
34                                                 },
35                                                 {
36                                                         "name": "extension",
37                                                         "description": "The extension to dial after the endpoint answers",
38                                                         "paramType": "query",
39                                                         "required": false,
40                                                         "allowMultiple": false,
41                                                         "dataType": "string"
42                                                 },
43                                                 {
44                                                         "name": "context",
45                                                         "description": "The context to dial after the endpoint answers. If omitted, uses 'default'",
46                                                         "paramType": "query",
47                                                         "required": false,
48                                                         "allowMultiple": false,
49                                                         "dataType": "string"
50                                                 },
51                                                 {
52                                                         "name": "priority",
53                                                         "description": "The priority to dial after the endpoint answers. If omitted, uses 1",
54                                                         "paramType": "query",
55                                                         "required": false,
56                                                         "allowMultiple": false,
57                                                         "dataType": "long"
58                                                 },
59                                                 {
60                                                         "name": "label",
61                                                         "description": "The label to dial after the endpoint answers. Will supersede 'priority' if provided.",
62                                                         "paramType": "query",
63                                                         "required": false,
64                                                         "allowMultiple": false,
65                                                         "dataType": "string"
66                                                 },
67                                                 {
68                                                         "name": "app",
69                                                         "description": "The application that is subscribed to the originated channel, and passed to the Stasis application.",
70                                                         "paramType": "query",
71                                                         "required": false,
72                                                         "allowMultiple": false,
73                                                         "dataType": "string"
74                                                 },
75                                                 {
76                                                         "name": "appArgs",
77                                                         "description": "The application arguments to pass to the Stasis application.",
78                                                         "paramType": "query",
79                                                         "required": false,
80                                                         "allowMultiple": false,
81                                                         "dataType": "string"
82                                                 },
83                                                 {
84                                                         "name": "callerId",
85                                                         "description": "CallerID to use when dialing the endpoint or extension.",
86                                                         "paramType": "query",
87                                                         "required": false,
88                                                         "allowMultiple": false,
89                                                         "dataType": "string"
90                                                 },
91                                                 {
92                                                         "name": "timeout",
93                                                         "description": "Timeout (in seconds) before giving up dialing, or -1 for no timeout.",
94                                                         "paramType": "query",
95                                                         "required": false,
96                                                         "allowMultiple": false,
97                                                         "dataType": "int",
98                                                         "defaultValue": 30
99                                                 },
100                                                 {
101                                                         "name": "variables",
102                                                         "description": "The \"variables\" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { \"endpoint\": \"SIP/Alice\", \"variables\": { \"CALLERID(name)\": \"Alice\" } }",
103                                                         "paramType": "body",
104                                                         "required": false,
105                                                         "dataType": "containers",
106                                                         "allowMultiple": false
107                                                 },
108                                                 {
109                                                         "name": "channelId",
110                                                         "description": "The unique id to assign the channel on creation.",
111                                                         "paramType": "query",
112                                                         "required": false,
113                                                         "allowMultiple": false,
114                                                         "dataType": "string"
115                                                 },
116                                                 {
117                                                         "name": "otherChannelId",
118                                                         "description": "The unique id to assign the second channel when using local channels.",
119                                                         "paramType": "query",
120                                                         "required": false,
121                                                         "allowMultiple": false,
122                                                         "dataType": "string"
123                                                 },
124                                                 {
125                                                         "name": "originator",
126                                                         "description": "The unique id of the channel which is originating this one.",
127                                                         "paramType": "query",
128                                                         "required": false,
129                                                         "allowMultiple": false,
130                                                         "dataType": "string"
131                                                 }
132                                         ],
133                                         "errorResponses": [
134                                                 {
135                                                         "code": 400,
136                                                         "reason": "Invalid parameters for originating a channel."
137                                                 }
138                                         ]
139                                 }
140                         ]
141                 },
142                 {
143                         "path": "/channels/{channelId}",
144                         "description": "Active channel",
145                         "operations": [
146                                 {
147                                         "httpMethod": "GET",
148                                         "summary": "Channel details.",
149                                         "nickname": "get",
150                                         "responseClass": "Channel",
151                                         "parameters": [
152                                                 {
153                                                         "name": "channelId",
154                                                         "description": "Channel's id",
155                                                         "paramType": "path",
156                                                         "required": true,
157                                                         "allowMultiple": false,
158                                                         "dataType": "string"
159                                                 }
160                                         ],
161                                         "errorResponses": [
162                                                 {
163                                                         "code": 404,
164                                                         "reason": "Channel not found"
165                                                 }
166                                         ]
167                                 },
168                                 {
169                                         "httpMethod": "POST",
170                                         "summary": "Create a new channel (originate with id).",
171                                         "notes": "The new channel is created immediately and a snapshot of it returned. If a Stasis application is provided it will be automatically subscribed to the originated channel for further events and updates.",
172                                         "nickname": "originateWithId",
173                                         "responseClass": "Channel",
174                                         "parameters": [
175                                                 {
176                                                         "name": "channelId",
177                                                         "description": "The unique id to assign the channel on creation.",
178                                                         "paramType": "path",
179                                                         "required": true,
180                                                         "allowMultiple": false,
181                                                         "dataType": "string"
182                                                 },
183                                                 {
184                                                         "name": "endpoint",
185                                                         "description": "Endpoint to call.",
186                                                         "paramType": "query",
187                                                         "required": true,
188                                                         "allowMultiple": false,
189                                                         "dataType": "string"
190                                                 },
191                                                 {
192                                                         "name": "extension",
193                                                         "description": "The extension to dial after the endpoint answers",
194                                                         "paramType": "query",
195                                                         "required": false,
196                                                         "allowMultiple": false,
197                                                         "dataType": "string"
198                                                 },
199                                                 {
200                                                         "name": "context",
201                                                         "description": "The context to dial after the endpoint answers. If omitted, uses 'default'",
202                                                         "paramType": "query",
203                                                         "required": false,
204                                                         "allowMultiple": false,
205                                                         "dataType": "string"
206                                                 },
207                                                 {
208                                                         "name": "priority",
209                                                         "description": "The priority to dial after the endpoint answers. If omitted, uses 1",
210                                                         "paramType": "query",
211                                                         "required": false,
212                                                         "allowMultiple": false,
213                                                         "dataType": "long"
214                                                 },
215                                                 {
216                                                         "name": "label",
217                                                         "description": "The label to dial after the endpoint answers. Will supersede priority, if provided",
218                                                         "paramType": "query",
219                                                         "required": false,
220                                                         "allowMultiple": false,
221                                                         "dataType": "string"
222                                                 },
223                                                 {
224                                                         "name": "app",
225                                                         "description": "The application that is subscribed to the originated channel, and passed to the Stasis application.",
226                                                         "paramType": "query",
227                                                         "required": false,
228                                                         "allowMultiple": false,
229                                                         "dataType": "string"
230                                                 },
231                                                 {
232                                                         "name": "appArgs",
233                                                         "description": "The application arguments to pass to the Stasis application.",
234                                                         "paramType": "query",
235                                                         "required": false,
236                                                         "allowMultiple": false,
237                                                         "dataType": "string"
238                                                 },
239                                                 {
240                                                         "name": "callerId",
241                                                         "description": "CallerID to use when dialing the endpoint or extension.",
242                                                         "paramType": "query",
243                                                         "required": false,
244                                                         "allowMultiple": false,
245                                                         "dataType": "string"
246                                                 },
247                                                 {
248                                                         "name": "timeout",
249                                                         "description": "Timeout (in seconds) before giving up dialing, or -1 for no timeout.",
250                                                         "paramType": "query",
251                                                         "required": false,
252                                                         "allowMultiple": false,
253                                                         "dataType": "int",
254                                                         "defaultValue": 30
255                                                 },
256                                                 {
257                                                         "name": "variables",
258                                                         "description": "The \"variables\" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { \"endpoint\": \"SIP/Alice\", \"variables\": { \"CALLERID(name)\": \"Alice\" } }",
259                                                         "paramType": "body",
260                                                         "required": false,
261                                                         "dataType": "containers",
262                                                         "allowMultiple": false
263                                                 },
264                                                 {
265                                                         "name": "otherChannelId",
266                                                         "description": "The unique id to assign the second channel when using local channels.",
267                                                         "paramType": "query",
268                                                         "required": false,
269                                                         "allowMultiple": false,
270                                                         "dataType": "string"
271                                                 },
272                                                 {
273                                                         "name": "originator",
274                                                         "description": "The unique id of the channel which is originating this one.",
275                                                         "paramType": "query",
276                                                         "required": false,
277                                                         "allowMultiple": false,
278                                                         "dataType": "string"
279                                                 }
280                                         ],
281                                         "errorResponses": [
282                                                 {
283                                                         "code": 400,
284                                                         "reason": "Invalid parameters for originating a channel."
285                                                 }
286                                         ]
287
288                                 },
289                                 {
290                                         "httpMethod": "DELETE",
291                                         "summary": "Delete (i.e. hangup) a channel.",
292                                         "nickname": "hangup",
293                                         "responseClass": "void",
294                                         "parameters": [
295                                                 {
296                                                         "name": "channelId",
297                                                         "description": "Channel's id",
298                                                         "paramType": "path",
299                                                         "required": true,
300                                                         "allowMultiple": false,
301                                                         "dataType": "string"
302                                                 },
303                                                 {
304                                                         "name": "reason",
305                                                         "description": "Reason for hanging up the channel",
306                                                         "paramType": "query",
307                                                         "required": false,
308                                                         "allowMultiple": false,
309                                                         "dataType": "string",
310                                                         "defalutValue": "normal",
311                                                         "allowableValues": {
312                                                                 "valueType": "LIST",
313                                                                 "values": [
314                                                                         "normal",
315                                                                         "busy",
316                                                                         "congestion"
317                                                                 ]
318                                                         }
319                                                 }
320                                         ],
321                                         "errorResponses": [
322                                                 {
323                                                         "code": 400,
324                                                         "reason": "Invalid reason for hangup provided"
325                                                 },
326                                                 {
327                                                         "code": 404,
328                                                         "reason": "Channel not found"
329                                                 }
330                                         ]
331                                 }
332                         ]
333                 },
334                 {
335                         "path": "/channels/{channelId}/continue",
336                         "description": "Exit application; continue execution in the dialplan",
337                         "operations": [
338                                 {
339                                         "httpMethod": "POST",
340                                         "summary": "Exit application; continue execution in the dialplan.",
341                                         "nickname": "continueInDialplan",
342                                         "responseClass": "void",
343                                         "parameters": [
344                                                 {
345                                                         "name": "channelId",
346                                                         "description": "Channel's id",
347                                                         "paramType": "path",
348                                                         "required": true,
349                                                         "allowMultiple": false,
350                                                         "dataType": "string"
351                                                 },
352                                                 {
353                                                         "name": "context",
354                                                         "description": "The context to continue to.",
355                                                         "paramType": "query",
356                                                         "required": false,
357                                                         "allowMultiple": false,
358                                                         "dataType": "string"
359                                                 },
360                                                 {
361                                                         "name": "extension",
362                                                         "description": "The extension to continue to.",
363                                                         "paramType": "query",
364                                                         "required": false,
365                                                         "allowMultiple": false,
366                                                         "dataType": "string"
367                                                 },
368                                                 {
369                                                         "name": "priority",
370                                                         "description": "The priority to continue to.",
371                                                         "paramType": "query",
372                                                         "required": false,
373                                                         "allowMultiple": false,
374                                                         "dataType": "int"
375                                                 },
376                                                 {
377                                                         "name": "label",
378                                                         "description": "The label to continue to - will supersede 'priority' if both are provided.",
379                                                         "paramType": "query",
380                                                         "required": false,
381                                                         "allowMultiple": false,
382                                                         "dataType": "string"
383                                                 }
384                                         ],
385                                         "errorResponses": [
386                                                 {
387                                                         "code": 404,
388                                                         "reason": "Channel not found"
389                                                 },
390                                                 {
391                                                         "code": 409,
392                                                         "reason": "Channel not in a Stasis application"
393                                                 }
394                                         ]
395                                 }
396                         ]
397                 },
398                 {
399                         "path": "/channels/{channelId}/answer",
400                         "description": "Answer a channel",
401                         "operations": [
402                                 {
403                                         "httpMethod": "POST",
404                                         "summary": "Answer a channel.",
405                                         "nickname": "answer",
406                                         "responseClass": "void",
407                                         "parameters": [
408                                                 {
409                                                         "name": "channelId",
410                                                         "description": "Channel's id",
411                                                         "paramType": "path",
412                                                         "required": true,
413                                                         "allowMultiple": false,
414                                                         "dataType": "string"
415                                                 }
416                                         ],
417                                         "errorResponses": [
418                                                 {
419                                                         "code": 404,
420                                                         "reason": "Channel not found"
421                                                 },
422                                                 {
423                                                         "code": 409,
424                                                         "reason": "Channel not in a Stasis application"
425                                                 }
426                                         ]
427                                 }
428                         ]
429                 },
430                 {
431                         "path": "/channels/{channelId}/ring",
432                         "description": "Send a ringing indication to a channel",
433                         "operations": [
434                                 {
435                                         "httpMethod": "POST",
436                                         "summary": "Indicate ringing to a channel.",
437                                         "nickname": "ring",
438                                         "responseClass": "void",
439                                         "parameters": [
440                                                 {
441                                                         "name": "channelId",
442                                                         "description": "Channel's id",
443                                                         "paramType": "path",
444                                                         "required": true,
445                                                         "allowMultiple": false,
446                                                         "dataType": "string"
447                                                 }
448                                         ],
449                                         "errorResponses": [
450                                                 {
451                                                         "code": 404,
452                                                         "reason": "Channel not found"
453                                                 },
454                                                 {
455                                                         "code": 409,
456                                                         "reason": "Channel not in a Stasis application"
457                                                 }
458                                         ]
459                                 },
460                                 {
461                                         "httpMethod": "DELETE",
462                                         "summary": "Stop ringing indication on a channel if locally generated.",
463                                         "nickname": "ringStop",
464                                         "responseClass": "void",
465                                         "parameters": [
466                                                 {
467                                                         "name": "channelId",
468                                                         "description": "Channel's id",
469                                                         "paramType": "path",
470                                                         "required": true,
471                                                         "allowMultiple": false,
472                                                         "dataType": "string"
473                                                 }
474                                         ],
475                                         "errorResponses": [
476                                                 {
477                                                         "code": 404,
478                                                         "reason": "Channel not found"
479                                                 },
480                                                 {
481                                                         "code": 409,
482                                                         "reason": "Channel not in a Stasis application"
483                                                 }
484                                         ]
485                                 }
486                         ]
487                 },
488                 {
489                         "path": "/channels/{channelId}/dtmf",
490                         "description": "Send DTMF to a channel",
491                         "operations": [
492                                 {
493                                         "httpMethod": "POST",
494                                         "summary": "Send provided DTMF to a given channel.",
495                                         "nickname": "sendDTMF",
496                                         "responseClass": "void",
497                                         "parameters": [
498                                                 {
499                                                         "name": "channelId",
500                                                         "description": "Channel's id",
501                                                         "paramType": "path",
502                                                         "required": true,
503                                                         "allowMultiple": false,
504                                                         "dataType": "string"
505                                                 },
506                                                 {
507                                                         "name": "dtmf",
508                                                         "description": "DTMF To send.",
509                                                         "paramType": "query",
510                                                         "required": false,
511                                                         "allowMultiple": false,
512                                                         "dataType": "string"
513                                                 },
514                                                 {
515                                                         "name": "before",
516                                                         "description": "Amount of time to wait before DTMF digits (specified in milliseconds) start.",
517                                                         "paramType": "query",
518                                                         "required": false,
519                                                         "allowMultiple": false,
520                                                         "dataType": "int",
521                                                         "defaultValue": 0
522                                                 },
523                                                 {
524                                                         "name": "between",
525                                                         "description": "Amount of time in between DTMF digits (specified in milliseconds).",
526                                                         "paramType": "query",
527                                                         "required": false,
528                                                         "allowMultiple": false,
529                                                         "dataType": "int",
530                                                         "defaultValue": 100
531                                                 },
532                                                 {
533                                                         "name": "duration",
534                                                         "description": "Length of each DTMF digit (specified in milliseconds).",
535                                                         "paramType": "query",
536                                                         "required": false,
537                                                         "allowMultiple": false,
538                                                         "dataType": "int",
539                                                         "defaultValue": 100
540                                                 },
541                                                 {
542                                                         "name": "after",
543                                                         "description": "Amount of time to wait after DTMF digits (specified in milliseconds) end.",
544                                                         "paramType": "query",
545                                                         "required": false,
546                                                         "allowMultiple": false,
547                                                         "dataType": "int",
548                                                         "defaultValue": 0
549                                                 }
550                                         ],
551                                         "errorResponses": [
552                                                 {
553                                                         "code": 400,
554                                                         "reason": "DTMF is required"
555                                                 },
556                                                 {
557                                                         "code": 404,
558                                                         "reason": "Channel not found"
559                                                 },
560                                                 {
561                                                         "code": 409,
562                                                         "reason": "Channel not in a Stasis application"
563                                                 }
564                                         ]
565                                 }
566                         ]
567                 },
568                 {
569                         "path": "/channels/{channelId}/mute",
570                         "description": "Mute a channel",
571                         "operations": [
572                                 {
573                                         "httpMethod": "POST",
574                                         "summary": "Mute a channel.",
575                                         "nickname": "mute",
576                                         "responseClass": "void",
577                                         "parameters": [
578                                                 {
579                                                         "name": "channelId",
580                                                         "description": "Channel's id",
581                                                         "paramType": "path",
582                                                         "required": true,
583                                                         "allowMultiple": false,
584                                                         "dataType": "string"
585                                                 },
586                                                 {
587                                                         "name": "direction",
588                                                         "description": "Direction in which to mute audio",
589                                                         "paramType": "query",
590                                                         "required": false,
591                                                         "allowMultiple": false,
592                                                         "dataType": "string",
593                                                         "defaultValue": "both",
594                                                         "allowableValues": {
595                                                                 "valueType": "LIST",
596                                                                 "values": [
597                                                                         "both",
598                                                                         "in",
599                                                                         "out"
600                                                                 ]
601                                                         }
602                                                 }
603                                         ],
604                                         "errorResponses": [
605                                                 {
606                                                         "code": 404,
607                                                         "reason": "Channel not found"
608                                                 },
609                                                 {
610                                                         "code": 409,
611                                                         "reason": "Channel not in a Stasis application"
612                                                 }
613                                         ]
614                                 },
615                                 {
616                                         "httpMethod": "DELETE",
617                                         "summary": "Unmute a channel.",
618                                         "nickname": "unmute",
619                                         "responseClass": "void",
620                                         "parameters": [
621                                                 {
622                                                         "name": "channelId",
623                                                         "description": "Channel's id",
624                                                         "paramType": "path",
625                                                         "required": true,
626                                                         "allowMultiple": false,
627                                                         "dataType": "string"
628                                                 },
629                                                 {
630                                                         "name": "direction",
631                                                         "description": "Direction in which to unmute audio",
632                                                         "paramType": "query",
633                                                         "required": false,
634                                                         "allowMultiple": false,
635                                                         "dataType": "string",
636                                                         "defaultValue": "both",
637                                                         "allowableValues": {
638                                                                 "valueType": "LIST",
639                                                                 "values": [
640                                                                         "both",
641                                                                         "in",
642                                                                         "out"
643                                                                 ]
644                                                         }
645                                                 }
646                                         ],
647                                         "errorResponses": [
648                                                 {
649                                                         "code": 404,
650                                                         "reason": "Channel not found"
651                                                 },
652                                                 {
653                                                         "code": 409,
654                                                         "reason": "Channel not in a Stasis application"
655                                                 }
656                                         ]
657                                 }
658                         ]
659                 },
660                 {
661                         "path": "/channels/{channelId}/hold",
662                         "description": "Put a channel on hold",
663                         "operations": [
664                                 {
665                                         "httpMethod": "POST",
666                                         "summary": "Hold a channel.",
667                                         "nickname": "hold",
668                                         "responseClass": "void",
669                                         "parameters": [
670                                                 {
671                                                         "name": "channelId",
672                                                         "description": "Channel's id",
673                                                         "paramType": "path",
674                                                         "required": true,
675                                                         "allowMultiple": false,
676                                                         "dataType": "string"
677                                                 }
678                                         ],
679                                         "errorResponses": [
680                                                 {
681                                                         "code": 404,
682                                                         "reason": "Channel not found"
683                                                 },
684                                                 {
685                                                         "code": 409,
686                                                         "reason": "Channel not in a Stasis application"
687                                                 }
688                                         ]
689                                 },
690                                 {
691                                         "httpMethod": "DELETE",
692                                         "summary": "Remove a channel from hold.",
693                                         "nickname": "unhold",
694                                         "responseClass": "void",
695                                         "parameters": [
696                                                 {
697                                                         "name": "channelId",
698                                                         "description": "Channel's id",
699                                                         "paramType": "path",
700                                                         "required": true,
701                                                         "allowMultiple": false,
702                                                         "dataType": "string"
703                                                 }
704                                         ],
705                                         "errorResponses": [
706                                                 {
707                                                         "code": 404,
708                                                         "reason": "Channel not found"
709                                                 },
710                                                 {
711                                                         "code": 409,
712                                                         "reason": "Channel not in a Stasis application"
713                                                 }
714                                         ]
715                                 }
716                         ]
717                 },
718                 {
719                         "path": "/channels/{channelId}/moh",
720                         "description": "Play music on hold to a channel",
721                         "operations": [
722                                 {
723                                         "httpMethod": "POST",
724                                         "summary": "Play music on hold to a channel.",
725                                         "notes": "Using media operations such as /play on a channel playing MOH in this manner will suspend MOH without resuming automatically. If continuing music on hold is desired, the stasis application must reinitiate music on hold.",
726                                         "nickname": "startMoh",
727                                         "responseClass": "void",
728                                         "parameters": [
729                                                 {
730                                                         "name": "channelId",
731                                                         "description": "Channel's id",
732                                                         "paramType": "path",
733                                                         "required": true,
734                                                         "allowMultiple": false,
735                                                         "dataType": "string"
736                                                 },
737                                                 {
738                                                         "name": "mohClass",
739                                                         "description": "Music on hold class to use",
740                                                         "paramType": "query",
741                                                         "required": false,
742                                                         "allowMultiple": false,
743                                                         "dataType": "string"
744                                                 }
745                                         ],
746                                         "errorResponses": [
747                                                 {
748                                                         "code": 404,
749                                                         "reason": "Channel not found"
750                                                 },
751                                                 {
752                                                         "code": 409,
753                                                         "reason": "Channel not in a Stasis application"
754                                                 }
755                                         ]
756                                 },
757                                 {
758                                         "httpMethod": "DELETE",
759                                         "summary": "Stop playing music on hold to a channel.",
760                                         "nickname": "stopMoh",
761                                         "responseClass": "void",
762                                         "parameters": [
763                                                 {
764                                                         "name": "channelId",
765                                                         "description": "Channel's id",
766                                                         "paramType": "path",
767                                                         "required": true,
768                                                         "allowMultiple": false,
769                                                         "dataType": "string"
770                                                 }
771                                         ],
772                                         "errorResponses": [
773                                                 {
774                                                         "code": 404,
775                                                         "reason": "Channel not found"
776                                                 },
777                                                 {
778                                                         "code": 409,
779                                                         "reason": "Channel not in a Stasis application"
780                                                 }
781                                         ]
782                                 }
783                         ]
784                 },
785                 {
786                         "path": "/channels/{channelId}/silence",
787                         "description": "Play silence to a channel",
788                         "operations": [
789                                 {
790                                         "httpMethod": "POST",
791                                         "summary": "Play silence to a channel.",
792                                         "notes": "Using media operations such as /play on a channel playing silence in this manner will suspend silence without resuming automatically.",
793                                         "nickname": "startSilence",
794                                         "responseClass": "void",
795                                         "parameters": [
796                                                 {
797                                                         "name": "channelId",
798                                                         "description": "Channel's id",
799                                                         "paramType": "path",
800                                                         "required": true,
801                                                         "allowMultiple": false,
802                                                         "dataType": "string"
803                                                 }
804                                         ],
805                                         "errorResponses": [
806                                                 {
807                                                         "code": 404,
808                                                         "reason": "Channel not found"
809                                                 },
810                                                 {
811                                                         "code": 409,
812                                                         "reason": "Channel not in a Stasis application"
813                                                 }
814                                         ]
815                                 },
816                                 {
817                                         "httpMethod": "DELETE",
818                                         "summary": "Stop playing silence to a channel.",
819                                         "nickname": "stopSilence",
820                                         "responseClass": "void",
821                                         "parameters": [
822                                                 {
823                                                         "name": "channelId",
824                                                         "description": "Channel's id",
825                                                         "paramType": "path",
826                                                         "required": true,
827                                                         "allowMultiple": false,
828                                                         "dataType": "string"
829                                                 }
830                                         ],
831                                         "errorResponses": [
832                                                 {
833                                                         "code": 404,
834                                                         "reason": "Channel not found"
835                                                 },
836                                                 {
837                                                         "code": 409,
838                                                         "reason": "Channel not in a Stasis application"
839                                                 }
840                                         ]
841                                 }
842                         ]
843                 },
844                 {
845                         "path": "/channels/{channelId}/play",
846                         "description": "Play media to a channel",
847                         "operations": [
848                                 {
849                                         "httpMethod": "POST",
850                                         "summary": "Start playback of media.",
851                                         "notes": "The media URI may be any of a number of URI's. Currently sound:, recording:, number:, digits:, characters:, and tone: URI's are supported. This operation creates a playback resource that can be used to control the playback of media (pause, rewind, fast forward, etc.)",
852                                         "nickname": "play",
853                                         "responseClass": "Playback",
854                                         "parameters": [
855                                                 {
856                                                         "name": "channelId",
857                                                         "description": "Channel's id",
858                                                         "paramType": "path",
859                                                         "required": true,
860                                                         "allowMultiple": false,
861                                                         "dataType": "string"
862                                                 },
863                                                 {
864                                                         "name": "media",
865                                                         "description": "Media's URI to play.",
866                                                         "paramType": "query",
867                                                         "required": true,
868                                                         "allowMultiple": false,
869                                                         "dataType": "string"
870                                                 },
871                                                 {
872                                                         "name": "lang",
873                                                         "description": "For sounds, selects language for sound.",
874                                                         "paramType": "query",
875                                                         "required": false,
876                                                         "allowMultiple": false,
877                                                         "dataType": "string"
878                                                 },
879                                                 {
880                                                         "name": "offsetms",
881                                                         "description": "Number of media to skip before playing.",
882                                                         "paramType": "query",
883                                                         "required": false,
884                                                         "allowMultiple": false,
885                                                         "dataType": "int"
886                                                 },
887                                                 {
888                                                         "name": "skipms",
889                                                         "description": "Number of milliseconds to skip for forward/reverse operations.",
890                                                         "paramType": "query",
891                                                         "required": false,
892                                                         "allowMultiple": false,
893                                                         "dataType": "int",
894                                                         "defaultValue": 3000
895                                                 },
896                                                 {
897                                                         "name": "playbackId",
898                                                         "description": "Playback ID.",
899                                                         "paramType": "query",
900                                                         "required": false,
901                                                         "allowMultiple": false,
902                                                         "dataType": "string"
903                                                 }
904                                         ],
905                                         "errorResponses": [
906                                                 {
907                                                         "code": 404,
908                                                         "reason": "Channel not found"
909                                                 },
910                                                 {
911                                                         "code": 409,
912                                                         "reason": "Channel not in a Stasis application"
913                                                 }
914                                         ]
915                                 }
916                         ]
917                 },
918                 {
919                         "path": "/channels/{channelId}/play/{playbackId}",
920                         "description": "Play media to a channel",
921                         "operations": [
922                                 {
923                                         "httpMethod": "POST",
924                                         "summary": "Start playback of media and specify the playbackId.",
925                                         "notes": "The media URI may be any of a number of URI's. Currently sound: and recording: URI's are supported. This operation creates a playback resource that can be used to control the playback of media (pause, rewind, fast forward, etc.)",
926                                         "nickname": "playWithId",
927                                         "responseClass": "Playback",
928                                         "parameters": [
929                                                 {
930                                                         "name": "channelId",
931                                                         "description": "Channel's id",
932                                                         "paramType": "path",
933                                                         "required": true,
934                                                         "allowMultiple": false,
935                                                         "dataType": "string"
936                                                 },
937                                                 {
938                                                         "name": "playbackId",
939                                                         "description": "Playback ID.",
940                                                         "paramType": "path",
941                                                         "required": true,
942                                                         "allowMultiple": false,
943                                                         "dataType": "string"
944                                                 },
945                                                 {
946                                                         "name": "media",
947                                                         "description": "Media's URI to play.",
948                                                         "paramType": "query",
949                                                         "required": true,
950                                                         "allowMultiple": false,
951                                                         "dataType": "string"
952                                                 },
953                                                 {
954                                                         "name": "lang",
955                                                         "description": "For sounds, selects language for sound.",
956                                                         "paramType": "query",
957                                                         "required": false,
958                                                         "allowMultiple": false,
959                                                         "dataType": "string"
960                                                 },
961                                                 {
962                                                         "name": "offsetms",
963                                                         "description": "Number of media to skip before playing.",
964                                                         "paramType": "query",
965                                                         "required": false,
966                                                         "allowMultiple": false,
967                                                         "dataType": "int"
968                                                 },
969                                                 {
970                                                         "name": "skipms",
971                                                         "description": "Number of milliseconds to skip for forward/reverse operations.",
972                                                         "paramType": "query",
973                                                         "required": false,
974                                                         "allowMultiple": false,
975                                                         "dataType": "int",
976                                                         "defaultValue": 3000
977                                                 }
978                                         ],
979                                         "errorResponses": [
980                                                 {
981                                                         "code": 404,
982                                                         "reason": "Channel not found"
983                                                 },
984                                                 {
985                                                         "code": 409,
986                                                         "reason": "Channel not in a Stasis application"
987                                                 }
988                                         ]
989                                 }
990                         ]
991                 },
992                 {
993                         "path": "/channels/{channelId}/record",
994                         "description": "Record audio from a channel",
995                         "operations": [
996                                 {
997                                         "httpMethod": "POST",
998                                         "summary": "Start a recording.",
999                                         "notes": "Record audio from a channel. Note that this will not capture audio sent to the channel. The bridge itself has a record feature if that's what you want.",
1000                                         "nickname": "record",
1001                                         "responseClass": "LiveRecording",
1002                                         "parameters": [
1003                                                 {
1004                                                         "name": "channelId",
1005                                                         "description": "Channel's id",
1006                                                         "paramType": "path",
1007                                                         "required": true,
1008                                                         "allowMultiple": false,
1009                                                         "dataType": "string"
1010                                                 },
1011                                                 {
1012                                                         "name": "name",
1013                                                         "description": "Recording's filename",
1014                                                         "paramType": "query",
1015                                                         "required": true,
1016                                                         "allowMultiple": false,
1017                                                         "dataType": "string"
1018                                                 },
1019                                                 {
1020                                                         "name": "format",
1021                                                         "description": "Format to encode audio in",
1022                                                         "paramType": "query",
1023                                                         "required": true,
1024                                                         "allowMultiple": false,
1025                                                         "dataType": "string"
1026                                                 },
1027                                                 {
1028                                                         "name": "maxDurationSeconds",
1029                                                         "description": "Maximum duration of the recording, in seconds. 0 for no limit",
1030                                                         "paramType": "query",
1031                                                         "required": false,
1032                                                         "allowMultiple": false,
1033                                                         "dataType": "int",
1034                                                         "defaultValue": 0,
1035                                                         "allowableValues": {
1036                                                                 "valueType": "RANGE",
1037                                                                 "min": 0
1038                                                         }
1039                                                 },
1040                                                 {
1041                                                         "name": "maxSilenceSeconds",
1042                                                         "description": "Maximum duration of silence, in seconds. 0 for no limit",
1043                                                         "paramType": "query",
1044                                                         "required": false,
1045                                                         "allowMultiple": false,
1046                                                         "dataType": "int",
1047                                                         "defaultValue": 0,
1048                                                         "allowableValues": {
1049                                                                 "valueType": "RANGE",
1050                                                                 "min": 0
1051                                                         }
1052                                                 },
1053                                                 {
1054                                                         "name": "ifExists",
1055                                                         "description": "Action to take if a recording with the same name already exists.",
1056                                                         "paramType": "query",
1057                                                         "required": false,
1058                                                         "allowMultiple": false,
1059                                                         "dataType": "string",
1060                                                         "defaultValue": "fail",
1061                                                         "allowableValues": {
1062                                                                 "valueType": "LIST",
1063                                                                 "values": [
1064                                                                         "fail",
1065                                                                         "overwrite",
1066                                                                         "append"
1067                                                                 ]
1068                                                         }
1069                                                 },
1070                                                 {
1071                                                         "name": "beep",
1072                                                         "description": "Play beep when recording begins",
1073                                                         "paramType": "query",
1074                                                         "required": false,
1075                                                         "allowMultiple": false,
1076                                                         "dataType": "boolean",
1077                                                         "defaultValue": false
1078                                                 },
1079                                                 {
1080                                                         "name": "terminateOn",
1081                                                         "description": "DTMF input to terminate recording",
1082                                                         "paramType": "query",
1083                                                         "required": false,
1084                                                         "allowMultiple": false,
1085                                                         "dataType": "string",
1086                                                         "defaultValue": "none",
1087                                                         "allowableValues": {
1088                                                                 "valueType": "LIST",
1089                                                                 "values": [
1090                                                                         "none",
1091                                                                         "any",
1092                                                                         "*",
1093                                                                         "#"
1094                                                                 ]
1095                                                         }
1096                                                 }
1097                                         ],
1098                                         "errorResponses": [
1099                                                 {
1100                                                         "code": 400,
1101                                                         "reason": "Invalid parameters"
1102                                                 },
1103                                                 {
1104                                                         "code": 404,
1105                                                         "reason": "Channel not found"
1106                                                 },
1107                                                 {
1108                                                         "code": 409,
1109                                                         "reason": "Channel is not in a Stasis application; the channel is currently bridged with other hcannels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail"
1110                                                 },
1111                                                 {
1112                                                         "code": 422,
1113                                                         "reason": "The format specified is unknown on this system"
1114                                                 }
1115                                         ]
1116                                 }
1117                         ]
1118                 },
1119                 {
1120                         "path": "/channels/{channelId}/variable",
1121                         "description": "Variables on a channel",
1122                         "operations": [
1123                                 {
1124                                         "httpMethod": "GET",
1125                                         "summary": "Get the value of a channel variable or function.",
1126                                         "nickname": "getChannelVar",
1127                                         "responseClass": "Variable",
1128                                         "parameters": [
1129                                                 {
1130                                                         "name": "channelId",
1131                                                         "description": "Channel's id",
1132                                                         "paramType": "path",
1133                                                         "required": true,
1134                                                         "allowMultiple": false,
1135                                                         "dataType": "string"
1136                                                 },
1137                                                 {
1138                                                         "name": "variable",
1139                                                         "description": "The channel variable or function to get",
1140                                                         "paramType": "query",
1141                                                         "required": true,
1142                                                         "allowMultiple": false,
1143                                                         "dataType": "string"
1144                                                 }
1145                                         ],
1146                                         "errorResponses": [
1147                                                 {
1148                                                         "code": 400,
1149                                                         "reason": "Missing variable parameter."
1150                                                 },
1151                                                 {
1152                                                         "code": 404,
1153                                                         "reason": "Channel not found"
1154                                                 },
1155                                                 {
1156                                                         "code": 409,
1157                                                         "reason": "Channel not in a Stasis application"
1158                                                 }
1159                                         ]
1160                                 },
1161                                 {
1162                                         "httpMethod": "POST",
1163                                         "summary": "Set the value of a channel variable or function.",
1164                                         "nickname": "setChannelVar",
1165                                         "responseClass": "void",
1166                                         "parameters": [
1167                                                 {
1168                                                         "name": "channelId",
1169                                                         "description": "Channel's id",
1170                                                         "paramType": "path",
1171                                                         "required": true,
1172                                                         "allowMultiple": false,
1173                                                         "dataType": "string"
1174                                                 },
1175                                                 {
1176                                                         "name": "variable",
1177                                                         "description": "The channel variable or function to set",
1178                                                         "paramType": "query",
1179                                                         "required": true,
1180                                                         "allowMultiple": false,
1181                                                         "dataType": "string"
1182                                                 },
1183                                                 {
1184                                                         "name": "value",
1185                                                         "description": "The value to set the variable to",
1186                                                         "paramType": "query",
1187                                                         "required": false,
1188                                                         "allowMultiple": false,
1189                                                         "dataType": "string"
1190                                                 }
1191                                         ],
1192                                         "errorResponses": [
1193                                                 {
1194                                                         "code": 400,
1195                                                         "reason": "Missing variable parameter."
1196                                                 },
1197                                                 {
1198                                                         "code": 404,
1199                                                         "reason": "Channel not found"
1200                                                 },
1201                                                 {
1202                                                         "code": 409,
1203                                                         "reason": "Channel not in a Stasis application"
1204                                                 }
1205                                         ]
1206                                 }
1207                         ]
1208                 },
1209                 {
1210                         "path": "/channels/{channelId}/snoop",
1211                         "description": "Snoop (spy/whisper) on a channel",
1212                         "operations": [
1213                                 {
1214                                         "httpMethod": "POST",
1215                                         "summary": "Start snooping.",
1216                                         "notes": "Snoop (spy/whisper) on a specific channel.",
1217                                         "nickname": "snoopChannel",
1218                                         "responseClass": "Channel",
1219                                         "parameters": [
1220                                                 {
1221                                                         "name": "channelId",
1222                                                         "description": "Channel's id",
1223                                                         "paramType": "path",
1224                                                         "required": true,
1225                                                         "allowMultiple": false,
1226                                                         "dataType": "string"
1227                                                 },
1228                                                 {
1229                                                         "name": "spy",
1230                                                         "description": "Direction of audio to spy on",
1231                                                         "paramType": "query",
1232                                                         "required": false,
1233                                                         "allowMultiple": false,
1234                                                         "dataType": "string",
1235                                                         "defaultValue": "none",
1236                                                         "allowableValues": {
1237                                                                 "valueType": "LIST",
1238                                                                 "values": [
1239                                                                         "none",
1240                                                                         "both",
1241                                                                         "out",
1242                                                                         "in"
1243                                                                 ]
1244                                                         }
1245                                                 },
1246                                                 {
1247                                                         "name": "whisper",
1248                                                         "description": "Direction of audio to whisper into",
1249                                                         "paramType": "query",
1250                                                         "required": false,
1251                                                         "allowMultiple": false,
1252                                                         "dataType": "string",
1253                                                         "defaultValue": "none",
1254                                                         "allowableValues": {
1255                                                                 "valueType": "LIST",
1256                                                                 "values": [
1257                                                                         "none",
1258                                                                         "both",
1259                                                                         "out",
1260                                                                         "in"
1261                                                                 ]
1262                                                         }
1263                                                 },
1264                                                 {
1265                                                         "name": "app",
1266                                                         "description": "Application the snooping channel is placed into",
1267                                                         "paramType": "query",
1268                                                         "required": true,
1269                                                         "allowMultiple": false,
1270                                                         "dataType": "string"
1271                                                 },
1272                                                 {
1273                                                         "name": "appArgs",
1274                                                         "description": "The application arguments to pass to the Stasis application",
1275                                                         "paramType": "query",
1276                                                         "required": false,
1277                                                         "allowMultiple": false,
1278                                                         "dataType": "string"
1279                                                 },
1280                                                 {
1281                                                         "name": "snoopId",
1282                                                         "description": "Unique ID to assign to snooping channel",
1283                                                         "paramType": "query",
1284                                                         "required": false,
1285                                                         "allowMultiple": false,
1286                                                         "dataType": "string"
1287                                                 }
1288                                         ],
1289                                         "errorResponses": [
1290                                                 {
1291                                                         "code": 400,
1292                                                         "reason": "Invalid parameters"
1293                                                 },
1294                                                 {
1295                                                         "code": 404,
1296                                                         "reason": "Channel not found"
1297                                                 }
1298                                         ]
1299                                 }
1300                         ]
1301                 },
1302                 {
1303                         "path": "/channels/{channelId}/snoop/{snoopId}",
1304                         "description": "Snoop (spy/whisper) on a channel",
1305                         "operations": [
1306                                 {
1307                                         "httpMethod": "POST",
1308                                         "summary": "Start snooping.",
1309                                         "notes": "Snoop (spy/whisper) on a specific channel.",
1310                                         "nickname": "snoopChannelWithId",
1311                                         "responseClass": "Channel",
1312                                         "parameters": [
1313                                                 {
1314                                                         "name": "channelId",
1315                                                         "description": "Channel's id",
1316                                                         "paramType": "path",
1317                                                         "required": true,
1318                                                         "allowMultiple": false,
1319                                                         "dataType": "string"
1320                                                 },
1321                                                 {
1322                                                         "name": "snoopId",
1323                                                         "description": "Unique ID to assign to snooping channel",
1324                                                         "paramType": "path",
1325                                                         "required": true,
1326                                                         "allowMultiple": false,
1327                                                         "dataType": "string"
1328                                                 },
1329                                                 {
1330                                                         "name": "spy",
1331                                                         "description": "Direction of audio to spy on",
1332                                                         "paramType": "query",
1333                                                         "required": false,
1334                                                         "allowMultiple": false,
1335                                                         "dataType": "string",
1336                                                         "defaultValue": "none",
1337                                                         "allowableValues": {
1338                                                                 "valueType": "LIST",
1339                                                                 "values": [
1340                                                                         "none",
1341                                                                         "both",
1342                                                                         "out",
1343                                                                         "in"
1344                                                                 ]
1345                                                         }
1346                                                 },
1347                                                 {
1348                                                         "name": "whisper",
1349                                                         "description": "Direction of audio to whisper into",
1350                                                         "paramType": "query",
1351                                                         "required": false,
1352                                                         "allowMultiple": false,
1353                                                         "dataType": "string",
1354                                                         "defaultValue": "none",
1355                                                         "allowableValues": {
1356                                                                 "valueType": "LIST",
1357                                                                 "values": [
1358                                                                         "none",
1359                                                                         "both",
1360                                                                         "out",
1361                                                                         "in"
1362                                                                 ]
1363                                                         }
1364                                                 },
1365                                                 {
1366                                                         "name": "app",
1367                                                         "description": "Application the snooping channel is placed into",
1368                                                         "paramType": "query",
1369                                                         "required": true,
1370                                                         "allowMultiple": false,
1371                                                         "dataType": "string"
1372                                                 },
1373                                                 {
1374                                                         "name": "appArgs",
1375                                                         "description": "The application arguments to pass to the Stasis application",
1376                                                         "paramType": "query",
1377                                                         "required": false,
1378                                                         "allowMultiple": false,
1379                                                         "dataType": "string"
1380                                                 }
1381                                         ],
1382                                         "errorResponses": [
1383                                                 {
1384                                                         "code": 400,
1385                                                         "reason": "Invalid parameters"
1386                                                 },
1387                                                 {
1388                                                         "code": 404,
1389                                                         "reason": "Channel not found"
1390                                                 }
1391                                         ]
1392                                 }
1393                         ]
1394                 }
1395         ],
1396         "models": {
1397                 "Dialed": {
1398                         "id": "Dialed",
1399                         "description": "Dialed channel information.",
1400                         "properties": {}
1401                 },
1402                 "DialplanCEP": {
1403                         "id": "DialplanCEP",
1404                         "description": "Dialplan location (context/extension/priority)",
1405                         "properties": {
1406                                 "context": {
1407                                         "required": true,
1408                                         "type": "string",
1409                                         "description": "Context in the dialplan"
1410                                 },
1411                                 "exten": {
1412                                         "required": true,
1413                                         "type": "string",
1414                                         "description": "Extension in the dialplan"
1415                                 },
1416                                 "priority": {
1417                                         "required": true,
1418                                         "type": "long",
1419                                         "description": "Priority in the dialplan"
1420                                 }
1421                         }
1422                 },
1423                 "CallerID": {
1424                         "id": "CallerID",
1425                         "description": "Caller identification",
1426                         "properties": {
1427                                 "name": {
1428                                         "required": true,
1429                                         "type": "string"
1430                                 },
1431                                 "number": {
1432                                         "required": true,
1433                                         "type": "string"
1434                                 }
1435                         }
1436                 },
1437                 "Channel": {
1438                         "id": "Channel",
1439                         "description": "A specific communication connection between Asterisk and an Endpoint.",
1440                         "properties": {
1441                                 "id": {
1442                                         "required": true,
1443                                         "type": "string",
1444                                         "description": "Unique identifier of the channel.\n\nThis is the same as the Uniqueid field in AMI."
1445                                 },
1446                                 "name": {
1447                                         "required": true,
1448                                         "type": "string",
1449                                         "description": "Name of the channel (i.e. SIP/foo-0000a7e3)"
1450                                 },
1451                                 "state": {
1452                                         "required": true,
1453                                         "type": "string",
1454                                         "allowableValues": {
1455                                                 "valueType": "LIST",
1456                                                 "values": [
1457                                                         "Down",
1458                                                         "Rsrved",
1459                                                         "OffHook",
1460                                                         "Dialing",
1461                                                         "Ring",
1462                                                         "Ringing",
1463                                                         "Up",
1464                                                         "Busy",
1465                                                         "Dialing Offhook",
1466                                                         "Pre-ring",
1467                                                         "Unknown"
1468                                                 ]
1469                                         }
1470                                 },
1471                                 "caller": {
1472                                         "required": true,
1473                                         "type": "CallerID"
1474                                 },
1475                                 "connected": {
1476                                         "required": true,
1477                                         "type": "CallerID"
1478                                 },
1479                                 "accountcode": {
1480                                         "required": true,
1481                                         "type": "string"
1482                                 },
1483                                 "dialplan": {
1484                                         "required": true,
1485                                         "type": "DialplanCEP",
1486                                         "description": "Current location in the dialplan"
1487                                 },
1488                                 "creationtime": {
1489                                         "required": true,
1490                                         "type": "Date",
1491                                         "description": "Timestamp when channel was created"
1492                                 },
1493                                 "language": {
1494                                         "required": true,
1495                                         "type": "string",
1496                                         "description": "The default spoken language"
1497                                 }
1498                         }
1499                 }
1500         }
1501 }