1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Mathieu Parent <math.parent@gmail.com>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Mathieu Parent <math.parent@gmail.com>
27  *
28  *
29  * skinny_protocol.h -- Skinny Call Control Protocol (SCCP) Endpoint Module
30  *
31  */
32 #ifndef _SKINNY_PROTOCOL_H
33 #define _SKINNY_PROTOCOL_H
34 
35 #include <switch.h>
36 /* mod_skinny.h should be loaded first */
37 #include "mod_skinny.h"
38 
39 /*****************************************************************************/
40 /* SKINNY TYPES */
41 /*****************************************************************************/
42 
43 /* Hardcode ptime in one place until we make it dynamic */
44 #define SKINNY_PTIME 20
45 
46 typedef enum {
47 	SKINNY_CODEC_NONE = 0,
48 	SKINNY_CODEC_NONSTANDARD = 1,
49 	SKINNY_CODEC_ALAW_64K = 2,
50 	SKINNY_CODEC_ALAW_56K = 3,
51 	SKINNY_CODEC_ULAW_64K = 4,
52 	SKINNY_CODEC_ULAW_56K = 5,
53 	SKINNY_CODEC_G722_64K = 6,
54 	SKINNY_CODEC_G722_56K = 7,
55 	SKINNY_CODEC_G722_48K = 8,
56 	SKINNY_CODEC_G723_1 = 9,
57 	SKINNY_CODEC_G728 = 10,
58 	SKINNY_CODEC_G729 = 11,
59 	SKINNY_CODEC_G729A = 12,
60 	SKINNY_CODEC_IS11172 = 13,
61 	SKINNY_CODEC_IS13818 = 14,
62 	SKINNY_CODEC_G729B = 15,
63 	SKINNY_CODEC_G729AB = 16,
64 	SKINNY_CODEC_GSM_FULL = 18,
65 	SKINNY_CODEC_GSM_HALF = 19,
66 	SKINNY_CODEC_GSM_EFULL = 20,
67 	SKINNY_CODEC_WIDEBAND_256K = 25,
68 	SKINNY_CODEC_DATA_64K = 32,
69 	SKINNY_CODEC_DATA_56K = 33,
70 	SKINNY_CODEC_G722_1_32K = 40,
71 	SKINNY_CODEC_G722_1_24K = 41,
72 	SKINNY_CODEC_GSM = 80,
73 	SKINNY_CODEC_ACTIVEVOICE = 81,
74 	SKINNY_CODEC_G726_32K = 82,
75 	SKINNY_CODEC_G726_24K = 83,
76 	SKINNY_CODEC_G726_16K = 84,
77 	SKINNY_CODEC_G729B_BIS = 85,
78 	SKINNY_CODEC_G729B_LOW = 86,
79 	SKINNY_CODEC_H261 = 100,
80 	SKINNY_CODEC_H263 = 101,
81 	SKINNY_CODEC_VIDEO = 102,
82 	SKINNY_CODEC_H264 = 103,
83 	SKINNY_CODEC_T120 = 105,
84 	SKINNY_CODEC_H224 = 106,
85 	SKINNY_CODEC_RFC2833_DYNPAYLOAD = 257
86 } skinny_codecs;
87 
88 char* skinny_codec2string(skinny_codecs skinnycodec);
89 
90 /*****************************************************************************/
91 /* SKINNY MESSAGE DATA */
92 /*****************************************************************************/
93 
94 #define skinny_create_message(message,msgtype,field) \
95     message = calloc(1, 12 + sizeof(message->data.field)); \
96     message->type = msgtype; \
97     message->length = 4 + sizeof(message->data.field)
98 
99 #define skinny_create_empty_message(message,msgtype) \
100     message = calloc(1, 12); \
101     message->type = msgtype; \
102     message->length = 4
103 
104 
105 /* KeepAliveMessage */
106 #define KEEP_ALIVE_MESSAGE 0x0000
107 
108 /* RegisterMessage */
109 #define REGISTER_MESSAGE 0x0001
110 
111 #ifdef _MSC_VER
112 #pragma pack(push, r1, 1)
113 #endif
114 
115 struct PACKED register_message {
116 	char device_name[16];
117 	uint32_t user_id;
118 	uint32_t instance;
119 	struct in_addr ip;
120 	uint32_t device_type;
121 	uint32_t max_streams;
122 };
123 
124 /* PortMessage */
125 #define PORT_MESSAGE 0x0002
126 struct PACKED port_message {
127 	uint16_t port;
128 };
129 
130 /* KeypadButtonMessage */
131 #define KEYPAD_BUTTON_MESSAGE 0x0003
132 struct PACKED keypad_button_message {
133 	uint32_t button;
134 	uint32_t line_instance;
135 	uint32_t call_id;
136 };
137 
138 /* EnblocCallMessage */
139 #define ENBLOC_CALL_MESSAGE 0x0004
140 struct PACKED enbloc_call_message {
141 	char called_party[24];
142 	uint32_t line_instance;
143 };
144 
145 /* StimulusMessage */
146 #define STIMULUS_MESSAGE 0x0005
147 struct PACKED stimulus_message {
148 	uint32_t instance_type; /* See enum skinny_button_definition */
149 	uint32_t instance;
150 	uint32_t call_id;
151 };
152 
153 /* OffHookMessage */
154 #define OFF_HOOK_MESSAGE 0x0006
155 struct PACKED off_hook_message {
156 	uint32_t line_instance;
157 	uint32_t call_id;
158 };
159 
160 /* OnHookMessage */
161 #define ON_HOOK_MESSAGE 0x0007
162 struct PACKED on_hook_message {
163 	uint32_t line_instance;
164 	uint32_t call_id;
165 };
166 
167 /* ForwardStatReqMessage */
168 #define FORWARD_STAT_REQ_MESSAGE 0x0009
169 struct PACKED forward_stat_req_message {
170 	uint32_t line_instance;
171 };
172 
173 /* SpeedDialStatReqMessage */
174 #define SPEED_DIAL_STAT_REQ_MESSAGE 0x000A
175 struct PACKED speed_dial_stat_req_message {
176 	uint32_t number;
177 };
178 
179 /* LineStatReqMessage */
180 #define LINE_STAT_REQ_MESSAGE 0x000B
181 struct PACKED line_stat_req_message {
182 	uint32_t number;
183 };
184 
185 /* ConfigStatReqMessage */
186 #define CONFIG_STAT_REQ_MESSAGE 0x000C
187 
188 /* TimeDateReqMessage */
189 #define TIME_DATE_REQ_MESSAGE 0x000D
190 
191 /* ButtonTemplateReqMessage */
192 #define BUTTON_TEMPLATE_REQ_MESSAGE 0x000E
193 
194 /* VersionReqMessage */
195 #define VERSION_REQ_MESSAGE 0x000F
196 
197 /* CapabilitiesResMessage */
198 #define CAPABILITIES_RES_MESSAGE 0x0010
199 struct PACKED station_capabilities {
200 	uint32_t codec;
201 	uint16_t max_frames_per_packet;
202 	char reserved[10];
203 };
204 
205 struct PACKED capabilities_res_message {
206 	uint32_t count;
207 	struct station_capabilities caps[SWITCH_MAX_CODECS];
208 };
209 
210 #define SERVER_REQ_MESSAGE 0x0012
211 
212 /* AlarmMessage */
213 #define ALARM_MESSAGE 0x0020
214 struct PACKED alarm_message {
215 	uint32_t alarm_severity;
216 	char display_message[80];
217 	uint32_t alarm_param1;
218 	uint32_t alarm_param2;
219 };
220 
221 /* OpenReceiveChannelAck */
222 #define OPEN_RECEIVE_CHANNEL_ACK_MESSAGE 0x0022
223 struct PACKED open_receive_channel_ack_message {
224 	uint32_t status;
225 	struct in_addr ip;
226 	uint32_t port;
227 	uint32_t pass_thru_party_id;
228 };
229 
230 /* SoftKeySetReqMessage */
231 #define SOFT_KEY_SET_REQ_MESSAGE 0x0025
232 
233 /* SoftKeyEventMessage */
234 #define SOFT_KEY_EVENT_MESSAGE 0x0026
235 struct PACKED soft_key_event_message {
236 	uint32_t event; /* See enum skinny_soft_key_event */
237 	uint32_t line_instance;
238 	uint32_t call_id;
239 };
240 
241 /* UnregisterMessage */
242 #define UNREGISTER_MESSAGE 0x0027
243 
244 /* SoftKeyTemplateReqMessage */
245 #define SOFT_KEY_TEMPLATE_REQ_MESSAGE 0x0028
246 
247 /* HeadsetStatusMessage */
248 #define HEADSET_STATUS_MESSAGE 0x002B
249 struct PACKED headset_status_message {
250 	uint32_t mode; /* 1=HeadsetOn; 2=HeadsetOff */
251 };
252 
253 /* MediaResourceNotification */
254 #define MEDIA_RESOURCE_MESSAGE 0x002C
255 struct PACKED media_resource_message {
256 	uint32_t device_type;
257 	uint32_t streams_in_service;
258 	uint32_t max_streams_per_conf;
259 	uint32_t streams_out_of_service;
260 };
261 
262 /* RegisterAvailableLinesMessage */
263 #define REGISTER_AVAILABLE_LINES_MESSAGE 0x002D
264 struct PACKED register_available_lines_message {
265 	uint32_t count;
266 };
267 
268 /* DeviceToUserDataMessage */
269 #define DEVICE_TO_USER_DATA_MESSAGE 0x002E
270 struct PACKED data_message {
271 	uint32_t application_id;
272 	uint32_t line_instance;
273 	uint32_t call_id;
274 	uint32_t transaction_id;
275 	uint32_t data_length;
276 	char data[1];
277 };
278 
279 /* DeviceToUserDataResponseMessage */
280 #define DEVICE_TO_USER_DATA_RESPONSE_MESSAGE 0x002F
281 /* See struct PACKED data_message */
282 
283 #define UPDATE_CAPABILITIES_MESSAGE 0x0030
284 
285 #define MAX_CUSTOM_PICTURES						6
286 #define MAX_LAYOUT_WITH_SAME_SERVICE			5
287 #define MAX_SERVICE_TYPE						4
288 #define SKINNY_MAX_CAPABILITIES					18	/*!< max capabilities allowed in Cap response message */
289 #define SKINNY_MAX_VIDEO_CAPABILITIES			10
290 #define SKINNY_MAX_DATA_CAPABILITIES			5
291 #define MAX_LEVEL_PREFERENCE					4
292 
293 /*!
294  * \brief Picture Format Structure
295  */
296 typedef struct {
297 	uint32_t custom_picture_format_width;                                      /*!< Picture Width */
298 	uint32_t custom_picture_format_height;                                     /*!< Picture Height */
299 	uint32_t custom_picture_format_pixelAspectRatio;                           /*!< Picture Pixel Aspect Ratio */
300 	uint32_t custom_picture_format_pixelclockConversionCode;                   /*!< Picture Pixel Conversion Code  */
301 	uint32_t custom_picture_format_pixelclockDivisor;                          /*!< Picture Pixel Divisor */
302 } custom_picture_format_t;
303 
304 
305 /*!
306  * \brief Video Level Preference Structure
307  */
308 typedef struct {
309 	uint32_t transmitPreference;                                            /*!< Transmit Preference */
310 	uint32_t format;                                                        /*!< Format / Codec */
311 	uint32_t maxBitRate;                                                    /*!< Maximum BitRate */
312 	uint32_t minBitRate;                                                    /*!< Minimum BitRate */
313 	uint32_t MPI;                                                           /*!<  */
314 	uint32_t serviceNumber;                                                 /*!< Service Number */
315 } levelPreference_t;                                                            /*!< Level Preference Structure */
316 
317 /*!
318  * \brief Layout Config Structure (Update Capabilities Message Struct)
319  * \since 20080111
320  */
321 typedef struct {
322 	uint32_t layout;                                                        /*!< Layout \todo what is layout? */
323 } layoutConfig_t;                                                               /*!< Layout Config Structure */
324 
325 
326 /*!
327  * \brief Service Resource Structure
328  */
329 typedef struct {
330 	uint32_t layoutCount;                                                   /*!< Layout Count */
331 	layoutConfig_t layout[MAX_LAYOUT_WITH_SAME_SERVICE];                    /*!< Layout */
332 	uint32_t serviceNum;                                                    /*!< Service Number */
333 	uint32_t maxStreams;                                                    /*!< Maximum number of Streams */
334 	uint32_t maxConferences;                                                /*!< Maximum number of Conferences */
335 	uint32_t activeConferenceOnRegistration;                                /*!< Active Conference On Registration */
336 } serviceResource_t;
337 
338 
339 
340 /*!
341  * \brief Audio Capabilities Structure
342  */
343 typedef struct {
344 	skinny_codecs payload_capability;                                   /*!< PayLoad Capability */
345 	uint32_t maxFramesPerPacket;                                        /*!< Maximum Number of Frames per IP Packet */
346 	uint32_t unknown[2];                                                /*!< this are related to G.723 */
347 } audioCap_t;
348 
349 /*!
350  * \brief Video Capabilities Structure
351  */
352 typedef struct {
353 	skinny_codecs payload_capability;                                   /*!< PayLoad Capability */
354 	uint32_t transmitOreceive;                                          /*!< Transmit of Receive */
355 	uint32_t levelPreferenceCount;                                      /*!< Level of Preference Count */
356 
357 	levelPreference_t levelPreference[MAX_LEVEL_PREFERENCE];                /*!< Level Preference */
358 
359 //      uint32_t codec_options[2];                                          /*!< Codec Options */
360 
361 	union {
362                 struct {
363                         uint32_t unknown1;
364                         uint32_t unknown2;
365                 } h263;
366                 struct {
367                         uint32_t profile;                                       /*!< H264 profile */
368                         uint32_t level;                                         /*!< H264 level */
369                 } h264;
370         } codec_options;
371 
372         /**
373          * Codec options contains data specific for every codec
374          *
375          * Here is a list of known parameters per codec
376         // H.261
377         uint32_t                temporalSpatialTradeOffCapability;
378         uint32_t                stillImageTransmission;
379 
380         // H.263
381         uint32_t                h263_capability_bitfield;
382         uint32_t                annexNandWFutureUse;
383 
384         // Video
385         uint32_t                modelNumber;
386         uint32_t                bandwidth;
387         */
388 } videoCap_t;                                                                   /*!< Video Capabilities Structure */
389 
390 /*!
391  * \brief Data Capabilities Structure
392  */
393 typedef struct {
394 	uint32_t payload_capability;                                             /*!< Payload Capability */
395 	uint32_t transmitOrReceive;                                             /*!< Transmit or Receive */
396 	uint32_t protocolDependentData;                                         /*!< Protocol Dependent Data */
397 	uint32_t maxBitRate;                                                    /*!< Maximum BitRate */
398 } dataCap_t;                                                                    /*!< Data Capabilities Structure */
399 
400 
401 struct PACKED update_capabilities_message {
402 	uint32_t audio_cap_count;                                     /*!< Audio Capability Count */
403 	uint32_t videoCapCount;                                     /*!< Video Capability Count */
404 	uint32_t dataCapCount;                                      /*!< Data Capability Count */
405 	uint32_t RTPPayloadFormat;                                      /*!< RTP Payload Format */
406 	uint32_t custom_picture_formatCount;                              /*!< Custom Picture Format Count */
407 
408 	custom_picture_format_t custom_picture_format[MAX_CUSTOM_PICTURES]; /*!< Custom Picture Format */
409 
410 	uint32_t activeStreamsOnRegistration;                           /*!< Active Streams on Registration */
411 	uint32_t maxBW;                                                 /*!< Max BW ?? */
412 
413 	uint32_t serviceResourceCount;                                  /*!< Service Resource Count */
414 	serviceResource_t serviceResource[MAX_SERVICE_TYPE];            /*!< Service Resource */
415 
416 	audioCap_t audioCaps[SKINNY_MAX_CAPABILITIES];                  /*!< Audio Capabilities */
417 	videoCap_t videoCaps[SKINNY_MAX_VIDEO_CAPABILITIES];            /*!< Video Capabilities */
418 	dataCap_t dataCaps[SKINNY_MAX_DATA_CAPABILITIES];               /*!< Data Capabilities */
419 
420 	uint32_t unknown;                                               /*!< Unknown */
421 };
422 
423 
424 /* ServiceUrlStatReqMessage */
425 #define SERVICE_URL_STAT_REQ_MESSAGE 0x0033
426 struct PACKED service_url_stat_req_message {
427 	uint32_t service_url_index;
428 };
429 
430 /* FeatureStatReqMessage */
431 #define FEATURE_STAT_REQ_MESSAGE 0x0034
432 struct PACKED feature_stat_req_message {
433 	uint32_t feature_index;
434 };
435 
436 /* DeviceToUserDataVersion1Message */
437 #define DEVICE_TO_USER_DATA_VERSION1_MESSAGE 0x0041
438 struct PACKED extended_data_message {
439 	uint32_t application_id;
440 	uint32_t line_instance;
441 	uint32_t call_id;
442 	uint32_t transaction_id;
443 	uint32_t data_length;
444 	uint32_t sequence_flag;
445 	uint32_t display_priority;
446 	uint32_t conference_id;
447 	uint32_t app_instance_id;
448 	uint32_t routing_id;
449 	char data[1];
450 };
451 
452 /* DeviceToUserDataResponseVersion1Message */
453 #define DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE 0x0042
454 /* See struct PACKED extended_data_message */
455 
456 /* DialedPhoneBookMessage */
457 #define DIALED_PHONE_BOOK_MESSAGE 0x0048
458 struct PACKED dialed_phone_book_message {
459 	uint32_t number_index; /* must be shifted 4 bits right */
460 	uint32_t line_instance;
461 	uint32_t unknown;
462 	char phone_number[256];
463 };
464 
465 /* AccessoryStatusMessage */
466 #define ACCESSORY_STATUS_MESSAGE 0x0049
467 struct PACKED accessory_status_message {
468 	uint32_t accessory_id;
469 	uint32_t accessory_status;
470 	/* uint32_t unknown; */ /* this field is missing in 7925G */
471 };
472 
473 /* RegisterAckMessage */
474 #define REGISTER_ACK_MESSAGE 0x0081
475 struct PACKED register_ack_message {
476 	uint32_t keep_alive;
477 	char date_format[6];
478 	char reserved[2];
479 	uint32_t secondary_keep_alive;
480 	char reserved2[4];
481 };
482 
483 /* StartToneMessage */
484 #define START_TONE_MESSAGE 0x0082
485 struct PACKED start_tone_message {
486 	uint32_t tone; /* see enum skinny_tone */
487 	uint32_t reserved;
488 	uint32_t line_instance;
489 	uint32_t call_id;
490 };
491 
492 /* StopToneMessage */
493 #define STOP_TONE_MESSAGE 0x0083
494 struct PACKED stop_tone_message {
495 	uint32_t line_instance;
496 	uint32_t call_id;
497 };
498 
499 /* SetRingerMessage */
500 #define SET_RINGER_MESSAGE 0x0085
501 struct PACKED set_ringer_message {
502 	uint32_t ring_type; /* See enum skinny_ring_type */
503 	uint32_t ring_mode; /* See enum skinny_ring_mode */
504 	uint32_t line_instance;
505 	uint32_t call_id;
506 };
507 
508 /* SetLampMessage */
509 #define SET_LAMP_MESSAGE 0x0086
510 struct PACKED set_lamp_message {
511 	uint32_t stimulus; /* See enum skinny_button_definition */
512 	uint32_t stimulus_instance;
513 	uint32_t mode; /* See enum skinny_lamp_mode */
514 };
515 
516 /* SetSpeakerModeMessage */
517 #define SET_SPEAKER_MODE_MESSAGE 0x0088
518 struct PACKED set_speaker_mode_message {
519 	uint32_t mode; /* See enum skinny_speaker_mode */
520 };
521 
522 /* StartMediaTransmissionMessage */
523 #define START_MEDIA_TRANSMISSION_MESSAGE 0x008A
524 struct PACKED start_media_transmission_message {
525 	uint32_t conference_id;
526 	uint32_t pass_thru_party_id;
527 	uint32_t remote_ip;
528 	uint32_t remote_port;
529 	uint32_t ms_per_packet;
530 	uint32_t payload_capacity;
531 	uint32_t precedence;
532 	uint32_t silence_suppression;
533 	uint16_t max_frames_per_packet;
534 	uint16_t unknown1;
535 	uint32_t g723_bitrate;
536 	/* ... */
537 };
538 
539 /* StopMediaTransmissionMessage */
540 #define STOP_MEDIA_TRANSMISSION_MESSAGE 0x008B
541 struct PACKED stop_media_transmission_message {
542 	uint32_t conference_id;
543 	uint32_t pass_thru_party_id;
544 	uint32_t conference_id2;
545 	/* ... */
546 };
547 
548 /* CallInfoMessage */
549 #define CALL_INFO_MESSAGE 0x008F
550 struct PACKED call_info_message {
551 	char calling_party_name[40];
552 	char calling_party[24];
553 	char called_party_name[40];
554 	char called_party[24];
555 	uint32_t line_instance;
556 	uint32_t call_id;
557 	uint32_t call_type; /* See enum skinny_call_type */
558 	char original_called_party_name[40];
559 	char original_called_party[24];
560 	char last_redirecting_party_name[40];
561 	char last_redirecting_party[24];
562 	uint32_t original_called_party_redirect_reason;
563 	uint32_t last_redirecting_reason;
564 	char calling_party_voice_mailbox[24];
565 	char called_party_voice_mailbox[24];
566 	char original_called_party_voice_mailbox[24];
567 	char last_redirecting_voice_mailbox[24];
568 	uint32_t call_instance;
569 	uint32_t call_security_status;
570 	uint32_t party_pi_restriction_bits;
571 };
572 
573 /* ForwardStatMessage */
574 #define FORWARD_STAT_MESSAGE 0x0090
575 struct PACKED forward_stat_message {
576 	uint32_t active_forward;
577 	uint32_t line_instance;
578 	uint32_t forward_all_active;
579 	char forward_all_number[24];
580 	uint32_t forward_busy_active;
581 	char forward_busy_number[24];
582 	uint32_t forward_noanswer_active;
583 	char forward_noanswer_number[24];
584 };
585 
586 /* SpeedDialStatMessage */
587 #define SPEED_DIAL_STAT_RES_MESSAGE 0x0091
588 struct PACKED speed_dial_stat_res_message {
589 	uint32_t number;
590 	char line[24];
591 	char label[40];
592 };
593 
594 /* LineStatMessage */
595 #define LINE_STAT_RES_MESSAGE 0x0092
596 struct PACKED line_stat_res_message {
597 	uint32_t number;
598 	char name[24];
599 	char shortname[40];
600 	char displayname[44];
601 };
602 
603 /* ConfigStatMessage */
604 #define CONFIG_STAT_RES_MESSAGE 0x0093
605 struct PACKED config_stat_res_message {
606 	char device_name[16];
607 	uint32_t user_id;
608 	uint32_t instance;
609 	char user_name[40];
610 	char server_name[40];
611 	uint32_t number_lines;
612 	uint32_t number_speed_dials;
613 };
614 
615 /* DefineTimeDate */
616 #define DEFINE_TIME_DATE_MESSAGE 0x0094
617 struct PACKED define_time_date_message {
618 	uint32_t year;
619 	uint32_t month;
620 	uint32_t day_of_week; /* monday = 1 */
621 	uint32_t day;
622 	uint32_t hour;
623 	uint32_t minute;
624 	uint32_t seconds;
625 	uint32_t milliseconds;
626 	uint32_t timestamp;
627 };
628 
629 /* ButtonTemplateMessage */
630 #define BUTTON_TEMPLATE_RES_MESSAGE 0x0097
631 struct PACKED button_definition {
632 	uint8_t instance_number;
633 	uint8_t button_definition; /* See enum skinny_button_definition */
634 };
635 
636 #define SKINNY_MAX_BUTTON_COUNT 42
637 struct PACKED button_template_message {
638 	uint32_t button_offset;
639 	uint32_t button_count;
640 	uint32_t total_button_count;
641 	struct button_definition btn[SKINNY_MAX_BUTTON_COUNT];
642 };
643 
644 /* VersionMessage */
645 #define VERSION_MESSAGE 0x0098
646 struct PACKED version_message {
647 	char version[16];
648 };
649 
650 /* CapabilitiesReqMessage */
651 #define CAPABILITIES_REQ_MESSAGE 0x009B
652 
653 /* RegisterRejectMessage */
654 #define REGISTER_REJECT_MESSAGE 0x009D
655 struct PACKED register_reject_message {
656 	char error[33];
657 };
658 
659 #define SERVER_RESPONSE_MESSAGE 0x009E
660 #define ServerMaxNameSize                       48
661 #define StationMaxServers                       5
662 /*!
663  * \brief Station Identifier Structure
664  */
665 typedef struct {
666 	char serverName[ServerMaxNameSize];                                     /*!< Server Name */
667 } ServerIdentifier;
668 
669 struct PACKED server_response_message {
670 	ServerIdentifier server[StationMaxServers];                     /*!< Server Identifier */
671 	uint32_t serverListenPort[StationMaxServers];                   /*!< Server is Listening on Port */
672 	uint32_t serverIpAddr[StationMaxServers];                       /*!< Server IP Port */
673 };                                                     /*!< Server Result Message Structure */
674 
675 
676 /* ResetMessage */
677 #define RESET_MESSAGE 0x009F
678 struct PACKED reset_message {
679 	uint32_t reset_type; /* See enum skinny_device_reset_types */
680 };
681 
682 /* KeepAliveAckMessage */
683 #define KEEP_ALIVE_ACK_MESSAGE 0x0100
684 
685 /* OpenReceiveChannelMessage */
686 #define OPEN_RECEIVE_CHANNEL_MESSAGE 0x0105
687 struct PACKED open_receive_channel_message {
688 	uint32_t conference_id;
689 	uint32_t pass_thru_party_id;
690 	uint32_t ms_per_packet;
691 	uint32_t payload_capacity;
692 	uint32_t echo_cancel_type;
693 	uint32_t g723_bitrate;
694 	uint32_t conference_id2;
695 	uint32_t reserved[14];
696 	uint32_t rtpdtmfpayload;
697 	uint32_t rtptimeout;
698 };
699 
700 /* CloseReceiveChannelMessage */
701 #define CLOSE_RECEIVE_CHANNEL_MESSAGE 0x0106
702 struct PACKED close_receive_channel_message {
703 	uint32_t conference_id;
704 	uint32_t pass_thru_party_id;
705 	uint32_t conference_id2;
706 };
707 
708 /* SoftKeyTemplateResMessage */
709 #define SOFT_KEY_TEMPLATE_RES_MESSAGE 0x0108
710 
711 struct PACKED soft_key_template_definition {
712 	char soft_key_label[16];
713 	uint32_t soft_key_event;
714 };
715 
716 struct PACKED soft_key_template_res_message {
717 	uint32_t soft_key_offset;
718 	uint32_t soft_key_count;
719 	uint32_t total_soft_key_count;
720 	struct soft_key_template_definition soft_key[32];
721 };
722 
723 /* SoftKeySetResMessage */
724 #define SOFT_KEY_SET_RES_MESSAGE 0x0109
725 struct PACKED soft_key_set_definition {
726 	uint8_t soft_key_template_index[16]; /* See enum skinny_soft_key_event */
727 	uint16_t soft_key_info_index[16];
728 };
729 
730 struct PACKED soft_key_set_res_message {
731 	uint32_t soft_key_set_offset;
732 	uint32_t soft_key_set_count;
733 	uint32_t total_soft_key_set_count;
734 	struct soft_key_set_definition soft_key_set[16];
735 	uint32_t res;
736 };
737 
738 /* SelectSoftKeysMessage */
739 #define SELECT_SOFT_KEYS_MESSAGE 0x0110
740 struct PACKED select_soft_keys_message {
741 	uint32_t line_instance;
742 	uint32_t call_id;
743 	uint32_t soft_key_set; /* See enum skinny_key_set */
744 	uint32_t valid_key_mask;
745 };
746 
747 /* CallStateMessage */
748 #define CALL_STATE_MESSAGE 0x0111
749 struct PACKED call_state_message {
750 	uint32_t call_state; /* See enum skinny_call_state */
751 	uint32_t line_instance;
752 	uint32_t call_id;
753 };
754 
755 /* DisplayPromptStatusMessage */
756 #define DISPLAY_PROMPT_STATUS_MESSAGE 0x0112
757 struct PACKED display_prompt_status_message {
758 	uint32_t timeout;
759 	char display[32];
760 	uint32_t line_instance;
761 	uint32_t call_id;
762 };
763 
764 /* ClearPromptStatusMessage */
765 #define CLEAR_PROMPT_STATUS_MESSAGE 0x0113
766 struct PACKED clear_prompt_status_message {
767 	uint32_t line_instance;
768 	uint32_t call_id;
769 };
770 
771 /* ActivateCallPlaneMessage */
772 #define ACTIVATE_CALL_PLANE_MESSAGE 0x0116
773 struct PACKED activate_call_plane_message {
774 	uint32_t line_instance;
775 };
776 
777 /* UnregisterAckMessage */
778 #define UNREGISTER_ACK_MESSAGE 0x0118
779 struct PACKED unregister_ack_message {
780 	uint32_t unregister_status;
781 };
782 
783 /* BackSpaceReqMessage */
784 #define BACK_SPACE_REQ_MESSAGE 0x0119
785 struct PACKED back_space_req_message {
786 	uint32_t line_instance;
787 	uint32_t call_id;
788 };
789 
790 /* DialedNumberMessage */
791 #define DIALED_NUMBER_MESSAGE 0x011D
792 struct PACKED dialed_number_message {
793 	char called_party[24];
794 	uint32_t line_instance;
795 	uint32_t call_id;
796 };
797 
798 /* UserToDeviceDataMessage */
799 #define USER_TO_DEVICE_DATA_MESSAGE 0x011E
800 /* See struct PACKED data_message */
801 
802 /* FeatureStatMessage */
803 #define FEATURE_STAT_RES_MESSAGE 0x011F
804 struct PACKED feature_stat_res_message {
805 	uint32_t index;
806 	uint32_t id;
807 	char text_label[40];
808 	uint32_t status;
809 };
810 
811 /* DisplayPriNotifyMessage */
812 #define DISPLAY_PRI_NOTIFY_MESSAGE 0x0120
813 struct PACKED display_pri_notify_message {
814 	uint32_t message_timeout;
815 	uint32_t priority;
816 	char notify[32];
817 };
818 
819 /* ServiceUrlStatMessage */
820 #define SERVICE_URL_STAT_RES_MESSAGE 0x012F
821 struct PACKED service_url_stat_res_message {
822 	uint32_t index;
823 	char url[256];
824 	char display_name[40];
825 };
826 
827 /* UserToDeviceDataVersion1Message */
828 #define USER_TO_DEVICE_DATA_VERSION1_MESSAGE 0x013F
829 /* See struct PACKED extended_data_message */
830 
831 /* DialedPhoneBookAckMessage */
832 #define DIALED_PHONE_BOOK_ACK_MESSAGE 0x0152
833 struct PACKED dialed_phone_book_ack_message {
834 	uint32_t number_index; /* must be shifted 4 bits right */
835 	uint32_t line_instance;
836 	uint32_t unknown;
837 	uint32_t unknown2;
838 };
839 
840 #ifdef _MSC_VER
841 #pragma pack(pop, r1)
842 #endif
843 
844 /* XMLAlarmMessage */
845 #define XML_ALARM_MESSAGE 0x015A
846 
847 /*****************************************************************************/
848 /* SKINNY MESSAGE */
849 /*****************************************************************************/
850 #define SKINNY_MESSAGE_FIELD_SIZE 4 /* 4-bytes field */
851 #define SKINNY_MESSAGE_HEADERSIZE 12 /* three 4-bytes fields */
852 #define SKINNY_MESSAGE_MAXSIZE 2048
853 
854 union skinny_data {
855 	/* no data for KEEP_ALIVE_MESSAGE */
856 	struct register_message reg;
857 	struct port_message port;
858 	struct keypad_button_message keypad_button;
859 	struct enbloc_call_message enbloc_call;
860 	struct stimulus_message stimulus;
861 	struct off_hook_message off_hook;
862 	struct on_hook_message on_hook;
863 	struct forward_stat_req_message forward_stat_req;
864 	struct speed_dial_stat_req_message speed_dial_req;
865 	struct line_stat_req_message line_req;
866 	/* no data for CONFIG_STAT_REQ_MESSAGE */
867 	/* no data for TIME_DATE_REQ_MESSAGE */
868 	/* no data for BUTTON_TEMPLATE_REQ_MESSAGE */
869 	/* no data for VERSION_REQ_MESSAGE */
870 	struct capabilities_res_message cap_res;
871 	struct alarm_message alarm;
872 	struct open_receive_channel_ack_message open_receive_channel_ack;
873 	/* no data for SOFT_KEY_SET_REQ_MESSAGE */
874 	struct soft_key_event_message soft_key_event;
875 	/* no data for UNREGISTER_MESSAGE */
876 	/* no data for SOFT_KEY_TEMPLATE_REQ_MESSAGE */
877 	struct headset_status_message headset_status;
878 	struct media_resource_message media_resource;
879 	struct register_available_lines_message reg_lines;
880 	/* see field "data" for DEVICE_TO_USER_DATA_MESSAGE */
881 	/* see field "data" for DEVICE_TO_USER_DATA_RESPONSE_MESSAGE */
882 	struct service_url_stat_req_message service_url_req;
883 	struct feature_stat_req_message feature_req;
884 	/* see field "extended_data" for DEVICE_TO_USER_DATA_VERSION1_MESSAGE */
885 	/* see field "extended_data" for DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE */
886 	struct dialed_phone_book_message dialed_phone_book;
887 	struct accessory_status_message accessory_status;
888 	struct register_ack_message reg_ack;
889 	struct start_tone_message start_tone;
890 	struct stop_tone_message stop_tone;
891 	struct set_ringer_message ringer;
892 	struct set_lamp_message lamp;
893 	struct set_speaker_mode_message speaker_mode;
894 	struct start_media_transmission_message start_media;
895 	struct stop_media_transmission_message stop_media;
896 	struct call_info_message call_info;
897 	struct forward_stat_message forward_stat;
898 	struct speed_dial_stat_res_message speed_dial_res;
899 	struct line_stat_res_message line_res;
900 	struct config_stat_res_message config_res;
901 	struct define_time_date_message define_time_date;
902 	struct button_template_message button_template;
903 	struct version_message version;
904 	/* no data for CAPABILITIES_REQ_MESSAGE */
905 	struct register_reject_message reg_rej;
906 	struct reset_message reset;
907 	struct server_response_message serv_res_mess;
908 	/* no data for KEEP_ALIVE_ACK_MESSAGE */
909 	struct open_receive_channel_message open_receive_channel;
910 	struct close_receive_channel_message close_receive_channel;
911 	struct soft_key_template_res_message soft_key_template;
912 	struct soft_key_set_res_message soft_key_set;
913 	struct select_soft_keys_message select_soft_keys;
914 	struct call_state_message call_state;
915 	struct display_prompt_status_message display_prompt_status;
916 	struct clear_prompt_status_message clear_prompt_status;
917 	struct activate_call_plane_message activate_call_plane;
918 	struct unregister_ack_message unregister_ack;
919 	struct back_space_req_message back_space_req;
920 	struct dialed_number_message dialed_number;
921 	/* see field "data" for USER_TO_DEVICE_DATA_MESSAGE */
922 	struct feature_stat_res_message feature_res;
923 	struct display_pri_notify_message display_pri_notify;
924 	struct service_url_stat_res_message service_url_res;
925 	/* see field "extended_data" for USER_TO_DEVICE_DATA_VERSION1_MESSAGE */
926 	struct dialed_phone_book_ack_message dialed_phone_book_ack;
927 
928 	struct update_capabilities_message upd_cap;
929 	struct data_message data;
930 	struct extended_data_message extended_data;
931 
932 	uint16_t as_uint16;
933 	char as_char[1];
934 };
935 
936 #ifdef _MSC_VER
937 #pragma pack(push, r1, 1)
938 #endif
939 
940 /*
941  * header is length+version
942  * body is type+data
943  * length is length of body
944  */
945 struct PACKED skinny_message {
946 	uint32_t length;
947 	uint32_t version;
948 	uint32_t type;
949 	union skinny_data data;
950 };
951 
952 #ifdef _MSC_VER
953 #pragma pack(pop, r1)
954 #endif
955 
956 typedef struct skinny_message skinny_message_t;
957 
958 
959 
960 /*****************************************************************************/
961 /* SKINNY FUNCTIONS */
962 /*****************************************************************************/
963 #define skinny_check_data_length(message, len) \
964 	if (message->length < len+4) {\
965 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,\
966 				"Received Too Short Skinny Message %s (type=%x,length=%d), expected %" SWITCH_SIZE_T_FMT ".\n",\
967 				skinny_message_type2str(request->type), request->type, request->length,\
968 				len+4);\
969 		return SWITCH_STATUS_FALSE;\
970 	}
971 #define skinny_check_data_length_soft(message, len) \
972 	(message->length >= len+4)
973 
974 switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req);
975 
976 switch_status_t skinny_device_event(listener_t *listener, switch_event_t **ev, switch_event_types_t event_id, const char *subclass_name);
977 
978 switch_status_t skinny_session_walk_lines(skinny_profile_t *profile, char *channel_uuid, switch_core_db_callback_func_t callback, void *data);
979 
980 void skinny_line_get(listener_t *listener, uint32_t instance, struct line_stat_res_message **button);
981 void skinny_speed_dial_get(listener_t *listener, uint32_t instance, struct speed_dial_stat_res_message **button);
982 void skinny_service_url_get(listener_t *listener, uint32_t instance, struct service_url_stat_res_message **button);
983 void skinny_feature_get(listener_t *listener, uint32_t instance, struct feature_stat_res_message **button);
984 
985 switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply, switch_bool_t discard);
986 #define  skinny_send_reply(listener, reply, discard)  skinny_perform_send_reply(listener, __FILE__, __SWITCH_FUNC__, __LINE__, reply, discard)
987 
988 switch_status_t skinny_perform_send_reply_quiet(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply, switch_bool_t discard);
989 #define  skinny_send_reply_quiet(listener, reply, discard)  skinny_perform_send_reply_quiet(listener, __FILE__, __SWITCH_FUNC__, __LINE__, reply, discard)
990 
991 switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *request);
992 
993 /*****************************************************************************/
994 /* SKINNY MESSAGE HELPER */
995 /*****************************************************************************/
996 switch_status_t perform_send_keep_alive_ack(listener_t *listener,
997 		const char *file, const char *func, int line);
998 #define send_keep_alive_ack(listener) perform_send_keep_alive_ack(listener, __FILE__, __SWITCH_FUNC__, __LINE__);
999 
1000 switch_status_t perform_send_register_ack(listener_t *listener,
1001 		const char *file, const char *func, int line,
1002 		uint32_t keep_alive,
1003 		char *date_format,
1004 		char *reserved,
1005 		uint32_t secondary_keep_alive,
1006 		char *reserved2);
1007 #define send_register_ack(listener, ...) perform_send_register_ack(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1008 
1009 switch_status_t perform_send_speed_dial_stat_res(listener_t *listener,
1010 		const char *file, const char *func, int line,
1011 		uint32_t number,
1012 		char *speed_line,
1013 		char *speed_label);
1014 #define send_speed_dial_stat_res(listener, ...) perform_send_speed_dial_stat_res(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1015 
1016 switch_status_t perform_send_start_tone(listener_t *listener,
1017 		const char *file, const char *func, int line,
1018 		uint32_t tone,
1019 		uint32_t reserved,
1020 		uint32_t line_instance,
1021 		uint32_t call_id);
1022 #define send_start_tone(listener, ...) perform_send_start_tone(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1023 
1024 switch_status_t perform_send_stop_tone(listener_t *listener,
1025 		const char *file, const char *func, int line,
1026 		uint32_t line_instance,
1027 		uint32_t call_id);
1028 #define send_stop_tone(listener, ...) perform_send_stop_tone(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1029 
1030 switch_status_t perform_send_set_ringer(listener_t *listener,
1031 		const char *file, const char *func, int line,
1032 		uint32_t ring_type,
1033 		uint32_t ring_mode,
1034 		uint32_t line_instance,
1035 		uint32_t call_id);
1036 #define send_set_ringer(listener, ...) perform_send_set_ringer(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1037 
1038 switch_status_t perform_send_forward_stat(listener_t *listener,
1039 		const char *file, const char *func, int line,
1040 		const char *forward_to);
1041 #define send_forward_stat(listener, ...) perform_send_forward_stat(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1042 
1043 switch_status_t perform_send_set_lamp(listener_t *listener,
1044 		const char *file, const char *func, int line,
1045 		uint32_t stimulus,
1046 		uint32_t stimulus_instance,
1047 		uint32_t mode);
1048 #define send_set_lamp(listener, ...) perform_send_set_lamp(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1049 
1050 switch_status_t perform_send_set_speaker_mode(listener_t *listener,
1051 		const char *file, const char *func, int line,
1052 		uint32_t mode);
1053 #define send_set_speaker_mode(listener, ...) perform_send_set_speaker_mode(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1054 
1055 switch_status_t perform_send_srvreq_response(listener_t *listener,
1056 		const char *file, const char *func, int line,
1057 		char *ip, uint32_t port);
1058 #define send_srvreq_response(listener, ...) perform_send_srvreq_response(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1059 
1060 switch_status_t perform_send_start_media_transmission(listener_t *listener,
1061 		const char *file, const char *func, int line,
1062 		uint32_t conference_id,
1063 		uint32_t pass_thru_party_id,
1064 		uint32_t remote_ip,
1065 		uint32_t remote_port,
1066 		uint32_t ms_per_packet,
1067 		uint32_t payload_capacity,
1068 		uint32_t precedence,
1069 		uint32_t silence_suppression,
1070 		uint16_t max_frames_per_packet,
1071 		uint32_t g723_bitrate);
1072 #define send_start_media_transmission(listener,...) perform_send_start_media_transmission(listener,__FILE__, __SWITCH_FUNC__, __LINE__,__VA_ARGS__)
1073 
1074 switch_status_t perform_send_stop_media_transmission(listener_t *listener,
1075 		const char *file, const char *func, int line,
1076 		uint32_t conference_id,
1077 		uint32_t pass_thru_party_id,
1078 		uint32_t conference_id2);
1079 #define send_stop_media_transmission(listener, ...) perform_send_stop_media_transmission(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1080 
1081 switch_status_t perform_send_call_info(listener_t *listener,
1082 		const char *file, const char *func, int line,
1083 		const char *calling_party_name,
1084 		const char *calling_party,
1085 		const char *called_party_name,
1086 		const char *called_party,
1087 		uint32_t line_instance,
1088 		uint32_t call_id,
1089 		uint32_t call_type,
1090 		const char *original_called_party_name,
1091 		const char *original_called_party,
1092 		const char *last_redirecting_party_name,
1093 		const char *last_redirecting_party,
1094 		uint32_t original_called_party_redirect_reason,
1095 		uint32_t last_redirecting_reason,
1096 		const char *calling_party_voice_mailbox,
1097 		const char *called_party_voice_mailbox,
1098 		const char *original_called_party_voice_mailbox,
1099 		const char *last_redirecting_voice_mailbox,
1100 		uint32_t call_instance,
1101 		uint32_t call_security_status,
1102 		uint32_t party_pi_restriction_bits);
1103 #define send_call_info(listener, ...) perform_send_call_info(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1104 
1105 switch_status_t perform_send_define_time_date(listener_t *listener,
1106 		const char *file, const char *func, int line,
1107 		uint32_t year,
1108 		uint32_t month,
1109 		uint32_t day_of_week, /* monday = 1 */
1110 		uint32_t day,
1111 		uint32_t hour,
1112 		uint32_t minute,
1113 		uint32_t seconds,
1114 		uint32_t milliseconds,
1115 		uint32_t timestamp);
1116 #define send_define_time_date(listener, ...) perform_send_define_time_date(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1117 
1118 switch_status_t perform_send_define_current_time_date(listener_t *listener,
1119 		const char *file, const char *func, int line);
1120 #define send_define_current_time_date(listener) perform_send_define_current_time_date(listener, __FILE__, __SWITCH_FUNC__, __LINE__)
1121 
1122 switch_status_t perform_send_version(listener_t *listener,
1123 		const char *file, const char *func, int line,
1124 		char *version);
1125 #define send_version(listener, ...) perform_send_version(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1126 
1127 switch_status_t perform_send_capabilities_req(listener_t *listener,
1128 		const char *file, const char *func, int line);
1129 #define send_capabilities_req(listener) perform_send_capabilities_req(listener, __FILE__, __SWITCH_FUNC__, __LINE__)
1130 
1131 switch_status_t perform_send_register_reject(listener_t *listener,
1132 		const char *file, const char *func, int line,
1133 		char *error);
1134 #define send_register_reject(listener, ...) perform_send_register_reject(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1135 
1136 switch_status_t perform_send_open_receive_channel(listener_t *listener,
1137 		const char *file, const char *func, int line,
1138 		uint32_t conference_id,
1139 		uint32_t pass_thru_party_id,
1140 		uint32_t ms_per_packet,
1141 		uint32_t payload_capacity,
1142 		uint32_t echo_cancel_type,
1143 		uint32_t g723_bitrate,
1144 		uint32_t conference_id2,
1145 		uint32_t reserved[10]);
1146 #define send_open_receive_channel(listener, ...) perform_send_open_receive_channel(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1147 
1148 switch_status_t perform_send_close_receive_channel(listener_t *listener,
1149 		const char *file, const char *func, int line,
1150 		uint32_t conference_id,
1151 		uint32_t pass_thru_party_id,
1152 		uint32_t conference_id2);
1153 #define send_close_receive_channel(listener, ...) perform_send_close_receive_channel(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1154 
1155 switch_status_t perform_send_select_soft_keys(listener_t *listener,
1156 		const char *file, const char *func, int line,
1157 		uint32_t line_instance,
1158 		uint32_t call_id,
1159 		uint32_t soft_key_set,
1160 		uint32_t valid_key_mask);
1161 #define send_select_soft_keys(listener, ...) perform_send_select_soft_keys(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1162 
1163 switch_status_t perform_send_call_state(listener_t *listener,
1164 		const char *file, const char *func, int line,
1165 		uint32_t call_state,
1166 		uint32_t line_instance,
1167 		uint32_t call_id);
1168 #define send_call_state(listener, ...) perform_send_call_state(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1169 
1170 switch_status_t perform_send_display_prompt_status(listener_t *listener,
1171 		const char *file, const char *func, int line,
1172 		uint32_t timeout,
1173 		const char *display,
1174 		uint32_t line_instance,
1175 		uint32_t call_id);
1176 #define send_display_prompt_status(listener, ...) perform_send_display_prompt_status(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1177 
1178 switch_status_t perform_send_display_prompt_status_textid(listener_t *listener,
1179 		const char *file, const char *func, int line,
1180 		uint32_t timeout,
1181 		uint32_t display_textid,
1182 		uint32_t line_instance,
1183 		uint32_t call_id);
1184 #define send_display_prompt_status_textid(listener, ...) perform_send_display_prompt_status_textid(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1185 
1186 switch_status_t perform_send_clear_prompt_status(listener_t *listener,
1187 		const char *file, const char *func, int line,
1188 		uint32_t line_instance,
1189 		uint32_t call_id);
1190 #define send_clear_prompt_status(listener, ...) perform_send_clear_prompt_status(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1191 
1192 switch_status_t perform_send_activate_call_plane(listener_t *listener,
1193 		const char *file, const char *func, int line,
1194 		uint32_t line_instance);
1195 #define send_activate_call_plane(listener, ...) perform_send_activate_call_plane(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1196 
1197 switch_status_t perform_send_back_space_request(listener_t *listener,
1198 		const char *file, const char *func, int line,
1199 		uint32_t line_instance,
1200 		uint32_t call_id);
1201 #define send_back_space_request(listener, ...) perform_send_back_space_request(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1202 
1203 switch_status_t perform_send_dialed_number(listener_t *listener,
1204 		const char *file, const char *func, int line,
1205 		char called_party[24],
1206 		uint32_t line_instance,
1207 		uint32_t call_id);
1208 #define send_dialed_number(listener, ...) perform_send_dialed_number(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1209 
1210 switch_status_t perform_send_display_pri_notify(listener_t *listener,
1211 		const char *file, const char *func, int line,
1212 		uint32_t message_timeout,
1213 		uint32_t priority,
1214 		char *notify);
1215 #define send_display_pri_notify(listener, ...) perform_send_display_pri_notify(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1216 
1217 switch_status_t perform_send_reset(listener_t *listener,
1218 		const char *file, const char *func, int line,
1219 		uint32_t reset_type);
1220 #define send_reset(listener, ...) perform_send_reset(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1221 
1222 switch_status_t perform_send_data(listener_t *listener,
1223 		const char *file, const char *func, int line,
1224 		uint32_t message_type,
1225 		uint32_t application_id,
1226 		uint32_t line_instance,
1227 		uint32_t call_id,
1228 		uint32_t transaction_id,
1229 		uint32_t data_length,
1230 		const char *data);
1231 #define send_data(listener, ...) perform_send_data(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1232 
1233 switch_status_t perform_send_extended_data(listener_t *listener,
1234 		const char *file, const char *func, int line,
1235 		uint32_t message_type,
1236 		uint32_t application_id,
1237 		uint32_t line_instance,
1238 		uint32_t call_id,
1239 		uint32_t transaction_id,
1240 		uint32_t data_length,
1241 		uint32_t sequence_flag,
1242 		uint32_t display_priority,
1243 		uint32_t conference_id,
1244 		uint32_t app_instance_id,
1245 		uint32_t routing_id,
1246 		const char *data);
1247 #define send_extended_data(listener, ...) perform_send_extended_data(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__)
1248 
1249 #endif /* _SKINNY_PROTOCOL_H */
1250 
1251 /* For Emacs:
1252  * Local Variables:
1253  * mode:c
1254  * indent-tabs-mode:t
1255  * tab-width:4
1256  * c-basic-offset:4
1257  * End:
1258  * For VIM:
1259  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
1260  */
1261 
1262