45 switch (display_format) {
51 snprintf(display, display_length,
"%s", name);
55 snprintf(display, display_length,
"%s", number);
59 if (name[0] || number[0]) {
60 snprintf(display, display_length,
"\"%s\" <%s>", name, number);
77 static void enc_ie_facility(
unsigned char **ntmode, msg_t *msg,
struct FacParm *fac,
int nt)
82 unsigned char buf[256];
84 len = encodeFac(buf, fac);
90 fac->Function = Fac_None;
94 p = msg_put(msg, len);
98 qi = (Q931_info_t *) (msg->data + mISDN_HEADER_LEN);
99 qi->QI_ELEMENT(facility) = p - (
unsigned char *) qi -
sizeof(Q931_info_t);
105 fac->Function = Fac_None;
122 fac->Function = Fac_None;
126 if (qi->QI_ELEMENT(facility)) {
127 p = (
unsigned char *) qi +
sizeof(Q931_info_t) + qi->QI_ELEMENT(facility) + 1;
134 if (decodeFac(p, fac)) {
135 cb_log(3, bc->
port,
"Decoding facility ie failed! Unrecognized facility message?\n");
144 cb_log(3,bc->
port,
"set_channel: bc->channel:%d channel:%d\n", bc->
channel, channel);
153 if (channel > 0 && bc->
nt ) {
163 if (channel > 0 && !bc->
nt ) {
172 CALL_PROCEEDING_t *proceeding = (CALL_PROCEEDING_t *) (msg->data + HEADER_LEN);
177 dec_ie_channel_id(proceeding->CHANNEL_ID, (Q931_info_t *)proceeding, &exclusive, &channel, nt,bc);
190 printf(
"Parsing PROCEEDING Msg\n");
196 CALL_PROCEEDING_t *proceeding;
197 msg_t *msg =(msg_t*)
create_l3msg(CC_PROCEEDING | REQUEST, MT_CALL_PROCEEDING, bc?bc->
l3_id:-1,
sizeof(CALL_PROCEEDING_t) ,
nt);
199 proceeding=(CALL_PROCEEDING_t*)((msg->data+HEADER_LEN));
206 if (bc->
fac_out.Function != Fac_None) {
213 printf(
"Building PROCEEDING Msg\n");
221 ALERTING_t *alerting = (ALERTING_t *) (msg->data + HEADER_LEN);
231 printf(
"Parsing ALERTING Msg\n");
240 ALERTING_t *alerting;
241 msg_t *msg =(msg_t*)
create_l3msg(CC_ALERTING | REQUEST, MT_ALERTING, bc?bc->
l3_id:-1,
sizeof(ALERTING_t) ,
nt);
243 alerting=(ALERTING_t*)((msg->data+HEADER_LEN));
250 if (bc->
fac_out.Function != Fac_None) {
257 printf(
"Building ALERTING Msg\n");
266 PROGRESS_t *
progress = (PROGRESS_t *) (msg->data + HEADER_LEN);
274 printf(
"Parsing PROGRESS Msg\n");
282 msg_t *msg =(msg_t*)
create_l3msg(CC_PROGRESS | REQUEST, MT_PROGRESS, bc?bc->
l3_id:-1,
sizeof(PROGRESS_t) ,
nt);
284 progress=(PROGRESS_t*)((msg->data+HEADER_LEN));
288 if (bc->
fac_out.Function != Fac_None) {
293 printf(
"Building PROGRESS Msg\n");
298 #if defined(AST_MISDN_ENHANCEMENTS) 309 static void extract_setup_Bc_Hlc_Llc(SETUP_t *setup,
int nt,
struct misdn_bchannel *
bc)
314 qi = (Q931_info_t *) setup;
318 p = (__u8 *) setup->BEARER;
320 if (qi->QI_ELEMENT(bearer_capability)) {
321 p = (__u8 *) qi +
sizeof(Q931_info_t) + qi->QI_ELEMENT(bearer_capability) + 1;
326 if (!p || *p == 0 ||
sizeof(bc->setup_bc_hlc_llc.Bc.Contents) < *p) {
327 bc->setup_bc_hlc_llc.Bc.Length = 0;
329 bc->setup_bc_hlc_llc.Bc.Length = *p;
330 memcpy(bc->setup_bc_hlc_llc.Bc.Contents, p + 1, *p);
335 p = (__u8 *) setup->LLC;
337 if (qi->QI_ELEMENT(llc)) {
338 p = (__u8 *) qi +
sizeof(Q931_info_t) + qi->QI_ELEMENT(llc) + 1;
343 if (!p || *p == 0 ||
sizeof(bc->setup_bc_hlc_llc.Llc.Contents) < *p) {
344 bc->setup_bc_hlc_llc.Llc.Length = 0;
346 bc->setup_bc_hlc_llc.Llc.Length = *p;
347 memcpy(bc->setup_bc_hlc_llc.Llc.Contents, p + 1, *p);
352 p = (__u8 *) setup->HLC;
354 if (qi->QI_ELEMENT(hlc)) {
355 p = (__u8 *) qi +
sizeof(Q931_info_t) + qi->QI_ELEMENT(hlc) + 1;
360 if (!p || *p == 0 ||
sizeof(bc->setup_bc_hlc_llc.Hlc.Contents) < *p) {
361 bc->setup_bc_hlc_llc.Hlc.Length = 0;
363 bc->setup_bc_hlc_llc.Hlc.Length = *p;
364 memcpy(bc->setup_bc_hlc_llc.Hlc.Contents, p + 1, *p);
372 SETUP_t *setup = (SETUP_t *) (msg->data + HEADER_LEN);
373 Q931_info_t *qi = (Q931_info_t *) (msg->data + HEADER_LEN);
381 printf(
"Parsing SETUP Msg\n");
415 dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *) setup, &type, &plan, &present, &screen, &reason, bc->
redirecting.
from.
number,
sizeof(bc->
redirecting.
from.
number), nt, bc);
442 int coding, capability, mode, rate, multi,
user, async, urate, stopbits, dbits, parity;
444 dec_ie_bearer(setup->BEARER, (Q931_info_t *)setup, &coding, &capability, &mode, &rate, &multi, &user, &async, &urate, &stopbits, &dbits, &parity, nt,bc);
445 switch (capability) {
481 dec_ie_channel_id(setup->CHANNEL_ID, (Q931_info_t *)setup, &exclusive, &channel, nt,bc);
496 #if defined(AST_MISDN_ENHANCEMENTS) 497 extract_setup_Bc_Hlc_Llc(setup, nt, bc);
501 #define ANY_CHANNEL 0xff 506 msg_t *msg =(msg_t*)
create_l3msg(CC_SETUP | REQUEST, MT_SETUP, bc?bc->
l3_id:-1,
sizeof(SETUP_t) ,
nt);
508 enum FacFunction fac_type;
510 setup=(SETUP_t*)((msg->data+HEADER_LEN));
517 fac_type = bc->
fac_out.Function;
518 if (fac_type != Fac_None) {
536 #
if defined(AST_MISDN_ENHANCEMENTS)
543 && fac_type != Fac_DivertingLegInformation2
573 char display[
sizeof(bc->
display)];
613 enc_ie_bearer(&setup->BEARER, msg, coding, capability, mode, rate, -1, user, nt,bc);
623 cb_log(1, bc->
port,
"ENCODING USERUSERINFO:%s\n", bc->
uu);
626 #if defined(AST_MISDN_ENHANCEMENTS) 627 extract_setup_Bc_Hlc_Llc(setup, nt, bc);
631 printf(
"Building SETUP Msg\n");
639 CONNECT_t *connect = (CONNECT_t *) (msg->data + HEADER_LEN);
645 bc->
ces = connect->ces;
678 printf(
"Parsing CONNECT Msg\n");
686 msg_t *msg =(msg_t*)
create_l3msg(CC_CONNECT | REQUEST, MT_CONNECT, bc?bc->
l3_id:-1,
sizeof(CONNECT_t) ,
nt);
688 cb_log(6,bc->
port,
"BUILD_CONNECT: bc:%p bc->l3id:%d, nt:%d\n",bc,bc->
l3_id,nt);
690 connect=(CONNECT_t*)((msg->data+HEADER_LEN));
710 char display[
sizeof(bc->
display)];
719 if (bc->
fac_out.Function != Fac_None) {
724 printf(
"Building CONNECT Msg\n");
732 SETUP_ACKNOWLEDGE_t *setup_acknowledge = (SETUP_ACKNOWLEDGE_t *) (msg->data + HEADER_LEN);
736 dec_ie_channel_id(setup_acknowledge->CHANNEL_ID, (Q931_info_t *)setup_acknowledge, &exclusive, &channel, nt,bc);
744 dec_ie_facility(setup_acknowledge->FACILITY, (Q931_info_t *) setup_acknowledge, &bc->
fac_in, nt, bc);
747 printf(
"Parsing SETUP_ACKNOWLEDGE Msg\n");
756 SETUP_ACKNOWLEDGE_t *setup_acknowledge;
757 msg_t *msg =(msg_t*)
create_l3msg(CC_SETUP_ACKNOWLEDGE | REQUEST, MT_SETUP_ACKNOWLEDGE, bc?bc->
l3_id:-1,
sizeof(SETUP_ACKNOWLEDGE_t) ,
nt);
759 setup_acknowledge=(SETUP_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
764 enc_ie_progress(&setup_acknowledge->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
766 if (bc->
fac_out.Function != Fac_None) {
771 printf(
"Building SETUP_ACKNOWLEDGE Msg\n");
779 printf(
"Parsing CONNECT_ACKNOWLEDGE Msg\n");
788 CONNECT_ACKNOWLEDGE_t *connect_acknowledge;
789 msg_t *msg =(msg_t*)
create_l3msg(CC_CONNECT | RESPONSE, MT_CONNECT, bc?bc->
l3_id:-1,
sizeof(CONNECT_ACKNOWLEDGE_t) ,
nt);
791 connect_acknowledge=(CONNECT_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
796 printf(
"Building CONNECT_ACKNOWLEDGE Msg\n");
804 printf(
"Parsing USER_INFORMATION Msg\n");
812 msg_t *msg =(msg_t*)
create_l3msg(CC_USER_INFORMATION | REQUEST, MT_USER_INFORMATION, bc?bc->
l3_id:-1,
sizeof(USER_INFORMATION_t) ,
nt);
815 printf(
"Building USER_INFORMATION Msg\n");
823 printf(
"Parsing SUSPEND_REJECT Msg\n");
831 msg_t *msg =(msg_t*)
create_l3msg(CC_SUSPEND_REJECT | REQUEST, MT_SUSPEND_REJECT, bc?bc->
l3_id:-1,
sizeof(SUSPEND_REJECT_t) ,
nt);
834 printf(
"Building SUSPEND_REJECT Msg\n");
842 printf(
"Parsing RESUME_REJECT Msg\n");
850 msg_t *msg =(msg_t*)
create_l3msg(CC_RESUME_REJECT | REQUEST, MT_RESUME_REJECT, bc?bc->
l3_id:-1,
sizeof(RESUME_REJECT_t) ,
nt);
853 printf(
"Building RESUME_REJECT Msg\n");
861 printf(
"Parsing HOLD Msg\n");
869 msg_t *msg =(msg_t*)
create_l3msg(CC_HOLD | REQUEST, MT_HOLD, bc?bc->
l3_id:-1,
sizeof(HOLD_t) ,
nt);
872 printf(
"Building HOLD Msg\n");
880 printf(
"Parsing SUSPEND Msg\n");
888 msg_t *msg =(msg_t*)
create_l3msg(CC_SUSPEND | REQUEST, MT_SUSPEND, bc?bc->
l3_id:-1,
sizeof(SUSPEND_t) ,
nt);
891 printf(
"Building SUSPEND Msg\n");
899 printf(
"Parsing RESUME Msg\n");
907 msg_t *msg =(msg_t*)
create_l3msg(CC_RESUME | REQUEST, MT_RESUME, bc?bc->
l3_id:-1,
sizeof(RESUME_t) ,
nt);
910 printf(
"Building RESUME Msg\n");
918 printf(
"Parsing HOLD_ACKNOWLEDGE Msg\n");
926 msg_t *msg =(msg_t*)
create_l3msg(CC_HOLD_ACKNOWLEDGE | REQUEST, MT_HOLD_ACKNOWLEDGE, bc?bc->
l3_id:-1,
sizeof(HOLD_ACKNOWLEDGE_t) ,
nt);
929 printf(
"Building HOLD_ACKNOWLEDGE Msg\n");
937 printf(
"Parsing SUSPEND_ACKNOWLEDGE Msg\n");
945 msg_t *msg =(msg_t*)
create_l3msg(CC_SUSPEND_ACKNOWLEDGE | REQUEST, MT_SUSPEND_ACKNOWLEDGE, bc?bc->
l3_id:-1,
sizeof(SUSPEND_ACKNOWLEDGE_t) ,
nt);
948 printf(
"Building SUSPEND_ACKNOWLEDGE Msg\n");
956 printf(
"Parsing RESUME_ACKNOWLEDGE Msg\n");
964 msg_t *msg =(msg_t*)
create_l3msg(CC_RESUME_ACKNOWLEDGE | REQUEST, MT_RESUME_ACKNOWLEDGE, bc?bc->
l3_id:-1,
sizeof(RESUME_ACKNOWLEDGE_t) ,
nt);
967 printf(
"Building RESUME_ACKNOWLEDGE Msg\n");
975 printf(
"Parsing HOLD_REJECT Msg\n");
983 msg_t *msg =(msg_t*)
create_l3msg(CC_HOLD_REJECT | REQUEST, MT_HOLD_REJECT, bc?bc->
l3_id:-1,
sizeof(HOLD_REJECT_t) ,
nt);
986 printf(
"Building HOLD_REJECT Msg\n");
994 printf(
"Parsing RETRIEVE Msg\n");
1002 msg_t *msg =(msg_t*)
create_l3msg(CC_RETRIEVE | REQUEST, MT_RETRIEVE, bc?bc->
l3_id:-1,
sizeof(RETRIEVE_t) ,
nt);
1005 printf(
"Building RETRIEVE Msg\n");
1013 printf(
"Parsing RETRIEVE_ACKNOWLEDGE Msg\n");
1022 RETRIEVE_ACKNOWLEDGE_t *retrieve_acknowledge;
1023 msg_t *msg =(msg_t*)
create_l3msg(CC_RETRIEVE_ACKNOWLEDGE | REQUEST, MT_RETRIEVE_ACKNOWLEDGE, bc?bc->
l3_id:-1,
sizeof(RETRIEVE_ACKNOWLEDGE_t) ,
nt);
1025 retrieve_acknowledge=(RETRIEVE_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
1029 printf(
"Building RETRIEVE_ACKNOWLEDGE Msg\n");
1037 printf(
"Parsing RETRIEVE_REJECT Msg\n");
1045 msg_t *msg =(msg_t*)
create_l3msg(CC_RETRIEVE_REJECT | REQUEST, MT_RETRIEVE_REJECT, bc?bc->
l3_id:-1,
sizeof(RETRIEVE_REJECT_t) ,
nt);
1048 printf(
"Building RETRIEVE_REJECT Msg\n");
1056 DISCONNECT_t *disconnect = (DISCONNECT_t *) (msg->data + HEADER_LEN);
1059 dec_ie_cause(disconnect->CAUSE, (Q931_info_t *)(disconnect), &location, &cause, nt,bc);
1060 if (cause>0) bc->
cause=cause;
1066 printf(
"Parsing DISCONNECT Msg\n");
1075 DISCONNECT_t *disconnect;
1076 msg_t *msg =(msg_t*)
create_l3msg(CC_DISCONNECT | REQUEST, MT_DISCONNECT, bc?bc->
l3_id:-1,
sizeof(DISCONNECT_t) ,
nt);
1078 disconnect=(DISCONNECT_t*)((msg->data+HEADER_LEN));
1082 enc_ie_progress(&disconnect->PROGRESS, msg, 0, nt ? 1 : 5, 8, nt, bc);
1085 if (bc->
fac_out.Function != Fac_None) {
1092 cb_log(1, bc->
port,
"ENCODING USERUSERINFO:%s\n", bc->
uu);
1096 printf(
"Building DISCONNECT Msg\n");
1104 RESTART_t *restart = (RESTART_t *) (msg->data + HEADER_LEN);
1109 printf(
"Parsing RESTART Msg\n");
1124 msg_t *msg =(msg_t*)
create_l3msg(CC_RESTART | REQUEST, MT_RESTART, bc?bc->
l3_id:-1,
sizeof(RESTART_t) ,
nt);
1126 restart=(RESTART_t*)((msg->data+HEADER_LEN));
1129 printf(
"Building RESTART Msg\n");
1146 RELEASE_t *release = (RELEASE_t *) (msg->data + HEADER_LEN);
1150 dec_ie_cause(release->CAUSE, (Q931_info_t *)(release), &location, &cause, nt,bc);
1151 if (cause>0) bc->
cause=cause;
1156 printf(
"Parsing RELEASE Msg\n");
1166 msg_t *msg =(msg_t*)
create_l3msg(CC_RELEASE | REQUEST, MT_RELEASE, bc?bc->
l3_id:-1,
sizeof(RELEASE_t) ,
nt);
1168 release=(RELEASE_t*)((msg->data+HEADER_LEN));
1173 if (bc->
fac_out.Function != Fac_None) {
1180 cb_log(1, bc->
port,
"ENCODING USERUSERINFO:%s\n", bc->
uu);
1184 printf(
"Building RELEASE Msg\n");
1192 RELEASE_COMPLETE_t *release_complete = (RELEASE_COMPLETE_t *) (msg->data + HEADER_LEN);
1195 iframe_t *frm = (iframe_t*) msg->data;
1198 mISDNuser_head_t *hh;
1199 hh=(mISDNuser_head_t*)msg->data;
1205 if (hh->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
1206 cb_log(0, stack->port,
"CC_RELEASE_COMPLETE|CONFIRM [NT] \n");
1210 if (frm->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
1211 cb_log(0, stack->port,
"CC_RELEASE_COMPLETE|CONFIRM [TE] \n");
1215 dec_ie_cause(release_complete->CAUSE, (Q931_info_t *)(release_complete), &location, &cause, nt,bc);
1216 if (cause>0) bc->
cause=cause;
1221 printf(
"Parsing RELEASE_COMPLETE Msg\n");
1228 RELEASE_COMPLETE_t *release_complete;
1229 msg_t *msg =(msg_t*)
create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE, bc?bc->
l3_id:-1,
sizeof(RELEASE_COMPLETE_t) ,
nt);
1231 release_complete=(RELEASE_COMPLETE_t*)((msg->data+HEADER_LEN));
1235 if (bc->
fac_out.Function != Fac_None) {
1242 cb_log(1, bc->
port,
"ENCODING USERUSERINFO:%s\n", bc->
uu);
1246 printf(
"Building RELEASE_COMPLETE Msg\n");
1254 FACILITY_t *facility = (FACILITY_t*)(msg->data+HEADER_LEN);
1255 Q931_info_t *qi = (Q931_info_t*)(msg->data+HEADER_LEN);
1256 unsigned char *p =
NULL;
1257 #if defined(AST_MISDN_ENHANCEMENTS) 1258 int description_code;
1266 printf(
"Parsing FACILITY Msg\n");
1269 bc->
fac_in.Function = Fac_None;
1272 if (qi->QI_ELEMENT(facility))
1273 p = (
unsigned char *)qi +
sizeof(Q931_info_t) + qi->QI_ELEMENT(facility) + 1;
1275 p = facility->FACILITY;
1280 if (decodeFac(p, &bc->
fac_in)) {
1281 cb_log(3, bc->
port,
"Decoding facility ie failed! Unrecognized facility message?\n");
1284 #if defined(AST_MISDN_ENHANCEMENTS) 1285 dec_ie_notify(facility->NOTIFY, qi, &description_code, nt, bc);
1286 if (description_code < 0) {
1320 unsigned char *ie_fac;
1321 unsigned char fac_tmp[256];
1323 FACILITY_t *facility;
1327 printf(
"Building FACILITY Msg\n");
1330 len = encodeFac(fac_tmp, &(bc->
fac_out));
1336 bc->
fac_out.Function = Fac_None;
1338 #if defined(AST_MISDN_ENHANCEMENTS) 1346 msg = (msg_t *)
create_l3msg(CC_FACILITY | REQUEST, MT_FACILITY, bc ? bc->
l3_id : -1,
sizeof(FACILITY_t),
nt);
1348 facility = (FACILITY_t *) (msg->data + HEADER_LEN);
1350 ie_fac = msg_put(msg, len);
1352 facility->FACILITY = ie_fac + 1;
1354 qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
1355 qi->QI_ELEMENT(facility) = ie_fac - (
unsigned char *)qi -
sizeof(Q931_info_t);
1358 memcpy(ie_fac, fac_tmp, len);
1361 bc->
fac_out.Function = Fac_None;
1365 printf(
"Sending %s as Display\n", bc->
display);
1370 #if defined(AST_MISDN_ENHANCEMENTS) 1394 #if defined(AST_MISDN_ENHANCEMENTS) 1412 reg = (REGISTER_t *) (msg->data + HEADER_LEN);
1423 #if defined(AST_MISDN_ENHANCEMENTS) 1440 msg = (msg_t *)
create_l3msg(CC_REGISTER | REQUEST, MT_REGISTER, bc ? bc->
l3_id : -1,
sizeof(REGISTER_t),
nt);
1442 reg = (REGISTER_t *) (msg->data + HEADER_LEN);
1444 if (bc->
fac_out.Function != Fac_None) {
1455 NOTIFY_t *notify = (NOTIFY_t *) (msg->data + HEADER_LEN);
1456 int description_code;
1463 printf(
"Parsing NOTIFY Msg\n");
1466 dec_ie_notify(notify->NOTIFY, (Q931_info_t *) notify, &description_code, nt, bc);
1467 if (description_code < 0) {
1500 msg_t *msg =(msg_t*)
create_l3msg(CC_NOTIFY | REQUEST, MT_NOTIFY, bc?bc->
l3_id:-1,
sizeof(NOTIFY_t) ,
nt);
1503 printf(
"Building NOTIFY Msg\n");
1506 notify = (NOTIFY_t *) (msg->data + HEADER_LEN);
1530 printf(
"Parsing STATUS_ENQUIRY Msg\n");
1536 msg_t *msg =(msg_t*)
create_l3msg(CC_STATUS_ENQUIRY | REQUEST, MT_STATUS_ENQUIRY, bc?bc->
l3_id:-1,
sizeof(STATUS_ENQUIRY_t) ,
nt);
1539 printf(
"Building STATUS_ENQUIRY Msg\n");
1547 INFORMATION_t *information = (INFORMATION_t *) (msg->data + HEADER_LEN);
1554 printf(
"Parsing INFORMATION Msg\n");
1561 INFORMATION_t *information;
1562 msg_t *msg =(msg_t*)
create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION, bc?bc->
l3_id:-1,
sizeof(INFORMATION_t) ,
nt);
1564 information=(INFORMATION_t*)((msg->data+HEADER_LEN));
1571 printf(
"Sending %s as Display\n", bc->
display);
1578 printf(
"Building INFORMATION Msg\n");
1586 STATUS_t *
status = (STATUS_t *) (msg->data + HEADER_LEN);
1590 dec_ie_cause(status->CAUSE, (Q931_info_t *)(status), &location, &cause, nt,bc);
1591 if (cause>0) bc->
cause=cause;
1594 printf(
"Parsing STATUS Msg\n");
1600 msg_t *msg =(msg_t*)
create_l3msg(CC_STATUS | REQUEST, MT_STATUS, bc?bc->
l3_id:-1,
sizeof(STATUS_t) ,
nt);
1603 printf(
"Building STATUS Msg\n");
1611 printf(
"Parsing STATUS Msg\n");
1617 msg_t *msg =(msg_t*)
create_l3msg(CC_STATUS | REQUEST, MT_STATUS, bc?bc->
l3_id:-1,
sizeof(STATUS_t) ,
nt);
1620 printf(
"Building STATUS Msg\n");
1640 #if defined(AST_MISDN_ENHANCEMENTS) 1641 { CC_REGISTER,
EVENT_REGISTER, parse_register, build_register,
"REGISTER" },
1673 #define msgs_max (sizeof(msgs_g)/sizeof(struct isdn_msg)) 1681 mISDNuser_head_t *hh = (mISDNuser_head_t*)msg->data;
1684 if ( (hh->prim&COMMAND_MASK)==(msgs[i].
misdn_msg&COMMAND_MASK))
return i;
1688 iframe_t *frm = (iframe_t*)msg->data;
1691 if ( (frm->prim&COMMAND_MASK)==(msgs[i].
misdn_msg&COMMAND_MASK))
return i;
1701 if ( event == msgs[i].event)
return i;
1703 cb_log(10,0,
"get_index: event not found!\n");
1711 if(i>=0)
return msgs[i].
event;
1718 if(i>=0)
return msgs[i].
info;
1738 if(i>=0)
return msgs[i].
info;
1766 if(i<0)
return NULL;
static void parse_resume_reject(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void enc_ie_useruser(unsigned char **ntmode, msg_t *msg, int protocol, char *user, int user_len, int nt, struct misdn_bchannel *bc)
static void parse_suspend_reject(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
char keypad[MISDN_MAX_KEYPAD_LEN]
Q.931 Keypad Facility IE contents.
static msg_t * build_restart(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
int display_setup
Put a display ie in the SETUP message.
static void enc_ie_notify(unsigned char **ntmode, msg_t *msg, int notify, int nt, struct misdn_bchannel *bc)
static void enc_ie_calling_pn(unsigned char **ntmode, msg_t *msg, int type, int plan, int present, int screen, char *number, int nt, struct misdn_bchannel *bc)
struct FacParm fac_out
Outbound FACILITY message function type and contents.
static void parse_release(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static msg_t * build_timeout(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
char number[MISDN_MAX_NUMBER_LEN]
Phone number (Address)
static void dec_ie_calling_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, char *number, size_t number_len, int nt, struct misdn_bchannel *bc)
static void parse_resume_acknowledge(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static msg_t * build_retrieve_reject(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static void parse_information(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static msg_t * build_resume(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
int uulen
User-User information string length in uu[].
char uu[256]
User-User information string.
static void dec_ie_keypad(unsigned char *p, Q931_info_t *qi, char *keypad, size_t keypad_len, int nt, struct misdn_bchannel *bc)
static void dec_ie_complete(unsigned char *p, Q931_info_t *qi, int *complete, int nt, struct misdn_bchannel *bc)
#define mISDNUSER_HEAD_SIZE
int restart_channel
B channel to restart if received a RESTART message.
static msg_t * build_hold_reject(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static void enc_ie_connected_pn(unsigned char **ntmode, msg_t *msg, int type, int plan, int present, int screen, char *number, int nt, struct misdn_bchannel *bc)
int ces
Not used. Saved mISDN stack CONNECT_t ces value.
static void parse_alerting(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
int mode
Q.931 Bearer Capability IE Transfer Mode field. Initialized to 0 (Circuit). Altered by incoming SETUP...
static void enc_ie_restart_ind(unsigned char **ntmode, msg_t *msg, unsigned char rind, int nt, struct misdn_bchannel *bc)
static msg_t * build_information(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
char EVENT_DTMF_TONE_INFO[]
enum event_response_e(* cb_event)(enum event_e event, struct misdn_bchannel *bc, void *user_data)
B channel control structure.
int outgoing_colp
Select what to do with outgoing COLP information.
int presentation
Number presentation restriction code 0=Allowed, 1=Restricted, 2=Unavailable.
static msg_t * build_proceeding(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
int sending_complete
TRUE if all digits necessary to complete the call are available. No more INFORMATION messages are nee...
char EVENT_NEW_L3ID_INFO[]
static void parse_hold(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
char EVENT_BCHAN_ACTIVATED_INFO[]
int capability
SETUP message bearer capability field code value.
static void parse_facility(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void enc_ie_called_pn(unsigned char **ntmode, msg_t *msg, int type, int plan, char *number, int nt, struct misdn_bchannel *bc)
char EVENT_NEW_CHANNEL_INFO[]
static void parse_restart(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
struct misdn_party_id to
Where the call is being redirected toward (Sent to the calling party)
static void enc_ie_channel_id(unsigned char **ntmode, msg_t *msg, int exclusive, int channel, int nt, struct misdn_bchannel *bc)
int progress_location
Progress Indicator IE location field.
static void parse_retrieve(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_hold_acknowledge(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void enc_ie_keypad(unsigned char **ntmode, msg_t *msg, char *keypad, int nt, struct misdn_bchannel *bc)
static void parse_suspend(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
msg_t * create_l3msg(int prim, int mt, int dinfo, int size, int ntmode)
int isdn_msg_parse_event(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static msg_t * build_status_enquiry(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *capability, int *mode, int *rate, int *multi, int *user, int *async, int *urate, int *stopbits, int *dbits, int *parity, int nt, struct misdn_bchannel *bc)
static void dec_ie_progress(unsigned char *p, Q931_info_t *qi, int *coding, int *location, int *progress, int nt, struct misdn_bchannel *bc)
static msg_t * build_setup_acknowledge(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_setup(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static void dec_ie_facility(unsigned char *p, Q931_info_t *qi, struct FacParm *fac, int nt, struct misdn_bchannel *bc)
static void parse_setup_acknowledge(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
char number[MISDN_MAX_NUMBER_LEN]
Dialed/Called Phone Number (Address)
char display[84]
Display message that can be displayed by the user phone.
static msg_t * build_notify(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static void enc_ie_redir_dn(unsigned char **ntmode, msg_t *msg, int type, int plan, int present, char *number, int nt, struct misdn_bchannel *bc)
static void dec_ie_called_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, char *number, size_t number_len, int nt, struct misdn_bchannel *bc)
static msg_t * build_alerting(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
int nt
TRUE if NT side of protocol (TE otherwise)
enum mISDN_NUMBER_TYPE number_type
Type-of-number in ISDN terms for the number.
msg_t *(* msg_builder)(struct isdn_msg *msgs, struct misdn_bchannel *bc, int nt)
static msg_t * build_connect_acknowledge(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
int display_connected
Put a display ie in the CONNECT message.
static void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, char *user, int *user_len, int nt, struct misdn_bchannel *bc)
static void build_display_str(char *display, size_t display_length, int display_format, const char *name, const char *number)
struct misdn_party_id caller
Originating/Caller ID information struct.
char name[MISDN_MAX_NAME_LEN]
Subscriber Name.
static void parse_user_information(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void dec_ie_connected_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, char *number, size_t number_len, int nt, struct misdn_bchannel *bc)
struct misdn_stack * get_stack_by_bc(struct misdn_bchannel *bc)
int progress_coding
Progress Indicator IE coding standard field.
static msg_t * build_user_information(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_release_complete(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
int misdn_lib_is_ptp(int port)
struct misdn_party_id connected
Connected-Party/Connected-Line ID information struct.
struct misdn_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
static void dec_ie_cause(unsigned char *p, Q931_info_t *qi, int *location, int *cause, int nt, struct misdn_bchannel *bc)
static msg_t * build_suspend(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
enum mISDN_NUMBER_TYPE number_type
Type-of-number in ISDN terms for the dialed/called number.
static void parse_status(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void enc_ie_redir_nr(unsigned char **ntmode, msg_t *msg, int type, int plan, int present, int screen, int reason, char *number, int nt, struct misdn_bchannel *bc)
char EVENT_BCHAN_ERROR_INFO[]
static void dec_ie_notify(unsigned char *p, Q931_info_t *qi, int *notify, int nt, struct misdn_bchannel *bc)
static void parse_setup(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_status_enquiry(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
int isdn_msg_get_index_by_event(struct isdn_msg msgs[], enum event_e event, int nt)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int isdn_msg_get_index(struct isdn_msg msgs[], msg_t *msg, int nt)
struct misdn_party_redirecting redirecting
Redirecting information struct (Where a call diversion or transfer was invoked)
int port
Logical Layer 1 port associated with this B channel.
static void parse_retrieve_acknowledge(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void dec_ie_redir_nr(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, int *reason, char *number, size_t number_len, int nt, struct misdn_bchannel *bc)
int urate
Q.931 Bearer Capability IE Layer 1 User Rate field.
static msg_t * build_suspend_acknowledge(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
struct misdn_party_dialing dialed
Dialed/Called information struct.
static void enc_ie_complete(unsigned char **ntmode, msg_t *msg, int complete, int nt, struct misdn_bchannel *bc)
char EVENT_PORT_ALARM_INFO[]
static void set_channel(struct misdn_bchannel *bc, int channel)
static void enc_ie_display(unsigned char **ntmode, msg_t *msg, char *display, int nt, struct misdn_bchannel *bc)
char EVENT_BCHAN_DATA_INFO[]
int nt
TRUE if NT side of protocol (TE otherwise)
static void enc_ie_facility(unsigned char **ntmode, msg_t *msg, struct FacParm *fac, int nt)
static void parse_connect(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_progress(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static msg_t * build_facility(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
void(* msg_parser)(struct isdn_msg *msgs, msg_t *msg, struct misdn_bchannel *bc, int nt)
static msg_t * build_suspend_reject(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static void parse_connect_acknowledge(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static msg_t * build_retrieve(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_progress(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
int to_changed
TRUE if the redirecting.to information has changed.
static void parse_release_complete(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
char * isdn_msg_get_info(struct isdn_msg msgs[], msg_t *msg, int nt)
int channel
Assigned B channel number B1, B2... 0 if not assigned.
char * isdn_get_info(struct isdn_msg msgs[], enum event_e event, int nt)
static msg_t * build_disconnect(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
int out_cause
Q.931 Cause for disconnection code (sent)
static void parse_timeout(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
enum mISDN_REDIRECTING_REASON reason
Reason a call is being redirected (Q.931 field value)
static void parse_resume(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static msg_t * build_connect(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
msg_t * isdn_msg_build_event(struct isdn_msg msgs[], struct misdn_bchannel *bc, enum event_e event, int nt)
static void parse_retrieve_reject(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
int user1
Q.931 Bearer Capability IE User Information Layer 1 Protocol field code.
enum mISDN_NOTIFY_CODE notify_description_code
Notification indicator ie description code.
static void enc_ie_bearer(unsigned char **ntmode, msg_t *msg, int coding, int capability, int mode, int rate, int multi, int user, int nt, struct misdn_bchannel *bc)
static msg_t * build_hold(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static void enc_ie_date(unsigned char **ntmode, msg_t *msg, time_t ti, int nt, struct misdn_bchannel *bc)
int progress_indicator
Progress Indicator IE progress description field. Used to determine if there is an inband audio messa...
static void parse_suspend_acknowledge(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
int rate
Q.931 Bearer Capability IE Information Transfer Rate field. Initialized to 0x10 (64kbit). Altered by incoming SETUP messages.
char EVENT_TONE_GENERATE_INFO[]
static void parse_hold_reject(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
int cause
Q.931 Cause for disconnection code (received)
char info_dad[MISDN_MAX_NUMBER_LEN]
Current overlap dialing digits to/from INFORMATION messages.
static void dec_ie_redir_dn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, char *number, size_t number_len, int nt, struct misdn_bchannel *bc)
int port
Logical Layer 1 port associated with this stack.
static void parse_proceeding(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_notify(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void enc_ie_cause(unsigned char **ntmode, msg_t *msg, int location, int cause, int nt, struct misdn_bchannel *bc)
int screening
Number screening code 0=Unscreened, 1=Passed Screen, 2=Failed Screen, 3=Network Number.
static void parse_disconnect(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
enum event_e isdn_msg_get_event(struct isdn_msg msgs[], msg_t *msg, int nt)
static msg_t * build_release(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_retrieve_acknowledge(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
int law
Companding ALaw/uLaw encoding (INFO_CODEC_ALAW / INFO_CODEC_ULAW)
void(* cb_log)(int level, int port, char *tmpl,...)
struct FacParm fac_in
Inbound FACILITY message function type and contents.
static msg_t * build_resume_reject(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_hold_acknowledge(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static void enc_ie_progress(unsigned char **ntmode, msg_t *msg, int coding, int location, int progress, int nt, struct misdn_bchannel *bc)
static msg_t * build_resume_acknowledge(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static void dec_ie_channel_id(unsigned char *p, Q931_info_t *qi, int *exclusive, int *channel, int nt, struct misdn_bchannel *bc)
enum mISDN_NUMBER_PLAN number_plan
Type-of-number numbering plan.
enum mISDN_NUMBER_PLAN number_plan
Type-of-number numbering plan.
int l3_id
Layer 3 process ID.
static msg_t * build_status(struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)