2 * Chan_Misdn -- Channel Driver for Asterisk
6 * Copyright (C) 2004, Christian Richter
8 * Christian Richter <crich@beronet.com>
10 * This program is free software, distributed under the terms of
11 * the GNU General Public License
19 void parse_proceeding (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
21 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
22 CALL_PROCEEDING_t *proceeding=(CALL_PROCEEDING_t*)((unsigned long)msg->data+ HEADER_LEN);
24 int exclusive, channel;
25 dec_ie_channel_id(proceeding->CHANNEL_ID, (Q931_info_t *)proceeding, &exclusive, &channel, nt,bc);
27 if (channel==0xff) /* any channel */
30 /* ALERT: is that everytime true ? */
31 if (channel > 0 && bc->stack->mode == NT_MODE)
32 bc->channel = channel;
35 dec_ie_progress(proceeding->PROGRESS, (Q931_info_t *)proceeding, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
38 printf("Parsing PROCEEDING Msg\n");
43 msg_t *build_proceeding (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
45 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
46 CALL_PROCEEDING_t *proceeding;
47 msg_t *msg =(msg_t*)create_l3msg(CC_PROCEEDING | REQUEST, MT_CALL_PROCEEDING, bc?bc->l3_id:-1, sizeof(CALL_PROCEEDING_t) ,nt);
49 proceeding=(CALL_PROCEEDING_t*)((msg->data+HEADER_LEN));
51 enc_ie_channel_id(&proceeding->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
54 enc_ie_progress(&proceeding->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
58 printf("Building PROCEEDING Msg\n");
62 void print_proceeding (struct isdn_msg msgs[])
66 void parse_alerting (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
68 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
69 ALERTING_t *alerting=(ALERTING_t*)((unsigned long)(msg->data+HEADER_LEN));
70 //Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);
72 dec_ie_progress(alerting->PROGRESS, (Q931_info_t *)alerting, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
75 printf("Parsing ALERTING Msg\n");
80 msg_t *build_alerting (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
82 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
84 msg_t *msg =(msg_t*)create_l3msg(CC_ALERTING | REQUEST, MT_ALERTING, bc?bc->l3_id:-1, sizeof(ALERTING_t) ,nt);
86 alerting=(ALERTING_t*)((msg->data+HEADER_LEN));
88 enc_ie_channel_id(&alerting->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
91 enc_ie_progress(&alerting->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
93 printf("Building ALERTING Msg\n");
97 void print_alerting (struct isdn_msg msgs[])
102 void parse_progress (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
104 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
105 PROGRESS_t *progress=(PROGRESS_t*)((unsigned long)(msg->data+HEADER_LEN));
106 //Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);
108 dec_ie_progress(progress->PROGRESS, (Q931_info_t *)progress, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
111 printf("Parsing PROGRESS Msg\n");
115 msg_t *build_progress (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
117 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
118 PROGRESS_t *progress;
119 msg_t *msg =(msg_t*)create_l3msg(CC_PROGRESS | REQUEST, MT_PROGRESS, bc?bc->l3_id:-1, sizeof(PROGRESS_t) ,nt);
121 progress=(PROGRESS_t*)((msg->data+HEADER_LEN));
124 printf("Building PROGRESS Msg\n");
128 void print_progress (struct isdn_msg msgs[])
133 void parse_setup (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
135 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
136 SETUP_t *setup= (SETUP_t*)((unsigned long)msg->data+HEADER_LEN);
137 Q931_info_t *qi=(Q931_info_t*)((unsigned long)msg->data+HEADER_LEN);
140 printf("Parsing SETUP Msg\n");
143 int type,plan,present, screen;
145 dec_ie_calling_pn(setup->CALLING_PN, qi, &type, &plan, &present, &screen, (unsigned char *)id, sizeof(id), nt,bc);
151 // cb_log(3, bc->stack->port, " --> Pres:0\n");
152 bc->pres=0; /* screened */
155 // cb_log(3, bc->stack->port, " --> Pres:1\n");
156 bc->pres=1; /* not screened */
159 // cb_log(3, bc->stack->port, " --> Pres:%d\n",present);
164 // cb_log(4, bc->stack->port, " --> Screen:0\n");
167 // cb_log(4, bc->stack->port, " --> Screen:%d\n",screen);
174 dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *)setup, &type, &plan, (unsigned char *)number, sizeof(number), nt,bc);
175 strcpy(bc->dad, number);
180 dec_ie_keypad(setup->KEYPAD, (Q931_info_t *)setup, (unsigned char *)keypad, sizeof(keypad), nt,bc);
181 strcpy(bc->keypad, keypad);
185 int sending_complete;
186 dec_ie_complete(setup->COMPLETE, (Q931_info_t *)setup, &sending_complete, nt,bc);
190 int type, plan, present, screen, reason;
192 dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *)setup, &type, &plan, &present, &screen, &reason, (unsigned char *)id, sizeof(id), nt,bc);
196 // cb_log(3, bc->stack->port, " --> Redirecting number (REDIR_NR): '%s'\n", id);
199 int coding, capability, mode, rate, multi, user, async, urate, stopbits, dbits, parity;
200 dec_ie_bearer(setup->BEARER, (Q931_info_t *)setup, &coding, &capability, &mode, &rate, &multi, &user, &async, &urate, &stopbits, &dbits, &parity, nt,bc);
201 switch (capability) {
202 case -1: bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
203 // cb_log(2, bc->stack->port, " --> cap -1 -> digital\n");
205 case 0: bc->capability=INFO_CAPABILITY_SPEECH;
206 // cb_log(2, bc->stack->port, " --> cap speech\n");
208 case 8: bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
216 // cb_log(2, bc->stack->port, " --> cap unres Digital (user l1 %d, async %d, user rate %d\n", user, async, urate);
218 case 9: bc->capability=INFO_CAPABILITY_DIGITAL_RESTRICTED;
219 // cb_log(2, bc->stack->port, " --> cap res Digital\n");
222 // cb_log(2, bc->stack->port, " --> cap Else\n");
228 bc->law=INFO_CODEC_ULAW;
231 bc->law=INFO_CODEC_ALAW;
234 bc->law=INFO_CODEC_ALAW;
238 bc->capability=capability;
241 int exclusive, channel;
242 dec_ie_channel_id(setup->CHANNEL_ID, (Q931_info_t *)setup, &exclusive, &channel, nt,bc);
243 if (channel==0xff) /* any channel */
247 bc->channel = channel;
250 dec_ie_progress(setup->PROGRESS, (Q931_info_t *)setup, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
254 #define ANY_CHANNEL 0xff /* IE attribut for 'any channel' */
255 msg_t *build_setup (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
257 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
259 msg_t *msg =(msg_t*)create_l3msg(CC_SETUP | REQUEST, MT_SETUP, bc?bc->l3_id:-1, sizeof(SETUP_t) ,nt);
261 setup=(SETUP_t*)((msg->data+HEADER_LEN));
263 // cb_log(2, bc->stack->port, " --> oad %s dad %s channel %d\n",bc->oad, bc->dad,bc->channel);
264 if (bc->channel == 0 || bc->channel == ANY_CHANNEL || bc->channel==-1)
265 enc_ie_channel_id(&setup->CHANNEL_ID, msg, 0, bc->channel, nt,bc);
267 enc_ie_channel_id(&setup->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
270 int type=bc->onumplan,plan=1,present=bc->pres,screen=0;
271 enc_ie_calling_pn(&setup->CALLING_PN, msg, type, plan, present,
272 screen, bc->oad, nt, bc);
277 enc_ie_called_pn(&setup->CALLED_PN, msg, bc->dnumplan, 1, bc->dad, nt,bc);
281 enc_ie_display(&setup->DISPLAY, msg, bc->display, nt,bc);
285 int coding=0, capability, mode=0 /* 2 for packet ! */
287 switch (bc->capability) {
288 case INFO_CAPABILITY_SPEECH: capability = 0;
289 // cb_log(2, bc->stack->port, " --> Speech\n");
291 case INFO_CAPABILITY_DIGITAL_UNRESTRICTED: capability = 8;
292 // cb_log(2, bc->stack->port, " --> cap unres Digital\n");
294 case INFO_CAPABILITY_DIGITAL_RESTRICTED: capability = 9;
295 // cb_log(2, bc->stack->port, " --> cap res Digital\n");
298 // cb_log(2, bc->stack->port, " --> cap Speech\n");
299 capability=bc->capability;
303 case INFO_CODEC_ULAW: user=2;
304 // cb_log(2, bc->stack->port, " --> Codec Ulaw\n");
306 case INFO_CODEC_ALAW: user=3;
307 // cb_log(2, bc->stack->port, " --> Codec Alaw\n");
313 enc_ie_bearer(&setup->BEARER, msg, coding, capability, mode, rate, -1, user, nt,bc);
317 printf("Building SETUP Msg\n");
322 void print_setup (struct isdn_msg msgs[])
326 void parse_connect (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
328 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
329 CONNECT_t *connect=(CONNECT_t*)((unsigned long)(msg->data+HEADER_LEN));
331 bc->ces = connect->ces;
332 bc->ces = connect->ces;
334 dec_ie_progress(connect->PROGRESS, (Q931_info_t *)connect, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
337 printf("Parsing CONNECT Msg\n");
340 msg_t *build_connect (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
342 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
344 msg_t *msg =(msg_t*)create_l3msg(CC_CONNECT | REQUEST, MT_CONNECT, bc?bc->l3_id:-1, sizeof(CONNECT_t) ,nt);
346 connect=(CONNECT_t*)((msg->data+HEADER_LEN));
351 enc_ie_date(&connect->DATE, msg, now, nt,bc);
355 int type=0, plan=1, present=2, screen=0;
356 enc_ie_connected_pn(&connect->CONNECT_PN, msg, type,plan, present, screen, (unsigned char*) bc->dad , nt , bc);
360 printf("Building CONNECT Msg\n");
364 void print_connect (struct isdn_msg msgs[])
369 void parse_setup_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
371 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
372 SETUP_ACKNOWLEDGE_t *setup_acknowledge=(SETUP_ACKNOWLEDGE_t*)((unsigned long)(msg->data+HEADER_LEN));
375 int exclusive, channel;
376 dec_ie_channel_id(setup_acknowledge->CHANNEL_ID, (Q931_info_t *)setup_acknowledge, &exclusive, &channel, nt,bc);
378 if (channel==0xff) /* any channel */
382 bc->channel = channel;
385 dec_ie_progress(setup_acknowledge->PROGRESS, (Q931_info_t *)setup_acknowledge, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
387 printf("Parsing SETUP_ACKNOWLEDGE Msg\n");
392 msg_t *build_setup_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
394 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
395 SETUP_ACKNOWLEDGE_t *setup_acknowledge;
396 msg_t *msg =(msg_t*)create_l3msg(CC_SETUP_ACKNOWLEDGE | REQUEST, MT_SETUP_ACKNOWLEDGE, bc?bc->l3_id:-1, sizeof(SETUP_ACKNOWLEDGE_t) ,nt);
398 setup_acknowledge=(SETUP_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
400 enc_ie_channel_id(&setup_acknowledge->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
403 enc_ie_progress(&setup_acknowledge->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
406 printf("Building SETUP_ACKNOWLEDGE Msg\n");
411 void print_setup_acknowledge (struct isdn_msg msgs[])
415 void parse_connect_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
418 printf("Parsing CONNECT_ACKNOWLEDGE Msg\n");
423 msg_t *build_connect_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
425 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
426 CONNECT_ACKNOWLEDGE_t *connect_acknowledge;
427 msg_t *msg =(msg_t*)create_l3msg(CC_CONNECT | RESPONSE, MT_CONNECT, bc?bc->l3_id:-1, sizeof(CONNECT_ACKNOWLEDGE_t) ,nt);
429 connect_acknowledge=(CONNECT_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
431 enc_ie_channel_id(&connect_acknowledge->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
434 printf("Building CONNECT_ACKNOWLEDGE Msg\n");
438 void print_connect_acknowledge (struct isdn_msg msgs[])
443 void parse_user_information (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
446 printf("Parsing USER_INFORMATION Msg\n");
451 msg_t *build_user_information (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
453 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
454 USER_INFORMATION_t *user_information;
455 msg_t *msg =(msg_t*)create_l3msg(CC_USER_INFORMATION | REQUEST, MT_USER_INFORMATION, bc?bc->l3_id:-1, sizeof(USER_INFORMATION_t) ,nt);
457 user_information=(USER_INFORMATION_t*)((msg->data+HEADER_LEN));
460 printf("Building USER_INFORMATION Msg\n");
464 void print_user_information (struct isdn_msg msgs[])
469 void parse_suspend_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
472 printf("Parsing SUSPEND_REJECT Msg\n");
477 msg_t *build_suspend_reject (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
479 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
480 SUSPEND_REJECT_t *suspend_reject;
481 msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND_REJECT | REQUEST, MT_SUSPEND_REJECT, bc?bc->l3_id:-1, sizeof(SUSPEND_REJECT_t) ,nt);
483 suspend_reject=(SUSPEND_REJECT_t*)((msg->data+HEADER_LEN));
486 printf("Building SUSPEND_REJECT Msg\n");
490 void print_suspend_reject (struct isdn_msg msgs[])
495 void parse_resume_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
498 printf("Parsing RESUME_REJECT Msg\n");
503 msg_t *build_resume_reject (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
505 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
506 RESUME_REJECT_t *resume_reject;
507 msg_t *msg =(msg_t*)create_l3msg(CC_RESUME_REJECT | REQUEST, MT_RESUME_REJECT, bc?bc->l3_id:-1, sizeof(RESUME_REJECT_t) ,nt);
509 resume_reject=(RESUME_REJECT_t*)((msg->data+HEADER_LEN));
512 printf("Building RESUME_REJECT Msg\n");
516 void print_resume_reject (struct isdn_msg msgs[])
521 void parse_hold (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
524 printf("Parsing HOLD Msg\n");
529 msg_t *build_hold (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
531 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
533 msg_t *msg =(msg_t*)create_l3msg(CC_HOLD | REQUEST, MT_HOLD, bc?bc->l3_id:-1, sizeof(HOLD_t) ,nt);
535 hold=(HOLD_t*)((msg->data+HEADER_LEN));
538 printf("Building HOLD Msg\n");
542 void print_hold (struct isdn_msg msgs[])
547 void parse_suspend (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
550 printf("Parsing SUSPEND Msg\n");
555 msg_t *build_suspend (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
557 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
559 msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND | REQUEST, MT_SUSPEND, bc?bc->l3_id:-1, sizeof(SUSPEND_t) ,nt);
561 suspend=(SUSPEND_t*)((msg->data+HEADER_LEN));
564 printf("Building SUSPEND Msg\n");
568 void print_suspend (struct isdn_msg msgs[])
573 void parse_resume (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
576 printf("Parsing RESUME Msg\n");
581 msg_t *build_resume (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
583 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
585 msg_t *msg =(msg_t*)create_l3msg(CC_RESUME | REQUEST, MT_RESUME, bc?bc->l3_id:-1, sizeof(RESUME_t) ,nt);
587 resume=(RESUME_t*)((msg->data+HEADER_LEN));
590 printf("Building RESUME Msg\n");
594 void print_resume (struct isdn_msg msgs[])
599 void parse_hold_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
602 printf("Parsing HOLD_ACKNOWLEDGE Msg\n");
607 msg_t *build_hold_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
609 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
610 HOLD_ACKNOWLEDGE_t *hold_acknowledge;
611 msg_t *msg =(msg_t*)create_l3msg(CC_HOLD_ACKNOWLEDGE | REQUEST, MT_HOLD_ACKNOWLEDGE, bc?bc->l3_id:-1, sizeof(HOLD_ACKNOWLEDGE_t) ,nt);
613 hold_acknowledge=(HOLD_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
616 printf("Building HOLD_ACKNOWLEDGE Msg\n");
620 void print_hold_acknowledge (struct isdn_msg msgs[])
625 void parse_suspend_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
628 printf("Parsing SUSPEND_ACKNOWLEDGE Msg\n");
633 msg_t *build_suspend_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
635 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
636 SUSPEND_ACKNOWLEDGE_t *suspend_acknowledge;
637 msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND_ACKNOWLEDGE | REQUEST, MT_SUSPEND_ACKNOWLEDGE, bc?bc->l3_id:-1, sizeof(SUSPEND_ACKNOWLEDGE_t) ,nt);
639 suspend_acknowledge=(SUSPEND_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
642 printf("Building SUSPEND_ACKNOWLEDGE Msg\n");
646 void print_suspend_acknowledge (struct isdn_msg msgs[])
651 void parse_resume_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
654 printf("Parsing RESUME_ACKNOWLEDGE Msg\n");
659 msg_t *build_resume_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
661 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
662 RESUME_ACKNOWLEDGE_t *resume_acknowledge;
663 msg_t *msg =(msg_t*)create_l3msg(CC_RESUME_ACKNOWLEDGE | REQUEST, MT_RESUME_ACKNOWLEDGE, bc?bc->l3_id:-1, sizeof(RESUME_ACKNOWLEDGE_t) ,nt);
665 resume_acknowledge=(RESUME_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
668 printf("Building RESUME_ACKNOWLEDGE Msg\n");
672 void print_resume_acknowledge (struct isdn_msg msgs[])
677 void parse_hold_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
680 printf("Parsing HOLD_REJECT Msg\n");
685 msg_t *build_hold_reject (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
687 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
688 HOLD_REJECT_t *hold_reject;
689 msg_t *msg =(msg_t*)create_l3msg(CC_HOLD_REJECT | REQUEST, MT_HOLD_REJECT, bc?bc->l3_id:-1, sizeof(HOLD_REJECT_t) ,nt);
691 hold_reject=(HOLD_REJECT_t*)((msg->data+HEADER_LEN));
694 printf("Building HOLD_REJECT Msg\n");
698 void print_hold_reject (struct isdn_msg msgs[])
703 void parse_retrieve (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
706 printf("Parsing RETRIEVE Msg\n");
711 msg_t *build_retrieve (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
713 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
714 RETRIEVE_t *retrieve;
715 msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE | REQUEST, MT_RETRIEVE, bc?bc->l3_id:-1, sizeof(RETRIEVE_t) ,nt);
717 retrieve=(RETRIEVE_t*)((msg->data+HEADER_LEN));
720 printf("Building RETRIEVE Msg\n");
724 void print_retrieve (struct isdn_msg msgs[])
729 void parse_retrieve_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
732 printf("Parsing RETRIEVE_ACKNOWLEDGE Msg\n");
737 msg_t *build_retrieve_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
739 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
740 RETRIEVE_ACKNOWLEDGE_t *retrieve_acknowledge;
741 msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE_ACKNOWLEDGE | REQUEST, MT_RETRIEVE_ACKNOWLEDGE, bc?bc->l3_id:-1, sizeof(RETRIEVE_ACKNOWLEDGE_t) ,nt);
743 retrieve_acknowledge=(RETRIEVE_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
745 enc_ie_channel_id(&retrieve_acknowledge->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
747 printf("Building RETRIEVE_ACKNOWLEDGE Msg\n");
751 void print_retrieve_acknowledge (struct isdn_msg msgs[])
756 void parse_retrieve_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
759 printf("Parsing RETRIEVE_REJECT Msg\n");
764 msg_t *build_retrieve_reject (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
766 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
767 RETRIEVE_REJECT_t *retrieve_reject;
768 msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE_REJECT | REQUEST, MT_RETRIEVE_REJECT, bc?bc->l3_id:-1, sizeof(RETRIEVE_REJECT_t) ,nt);
770 retrieve_reject=(RETRIEVE_REJECT_t*)((msg->data+HEADER_LEN));
773 printf("Building RETRIEVE_REJECT Msg\n");
777 void print_retrieve_reject (struct isdn_msg msgs[])
782 void parse_disconnect (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
784 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
785 DISCONNECT_t *disconnect=(DISCONNECT_t*)((unsigned long)(msg->data+HEADER_LEN));
788 dec_ie_cause(disconnect->CAUSE, (Q931_info_t *)(disconnect), &location, &bc->cause, nt,bc);
790 dec_ie_progress(disconnect->PROGRESS, (Q931_info_t *)disconnect, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
792 printf("Parsing DISCONNECT Msg\n");
797 msg_t *build_disconnect (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
799 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
800 DISCONNECT_t *disconnect;
801 msg_t *msg =(msg_t*)create_l3msg(CC_DISCONNECT | REQUEST, MT_DISCONNECT, bc?bc->l3_id:-1, sizeof(DISCONNECT_t) ,nt);
803 disconnect=(DISCONNECT_t*)((msg->data+HEADER_LEN));
805 enc_ie_cause(&disconnect->CAUSE, msg, (nt)?1:0, bc->out_cause,nt,bc);
806 if (nt) enc_ie_progress(&disconnect->PROGRESS, msg, 0, nt?1:5, 8 ,nt,bc);
809 printf("Building DISCONNECT Msg\n");
813 void print_disconnect (struct isdn_msg msgs[])
818 void parse_restart (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
820 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
821 RESTART_t *restart=(RESTART_t*)((unsigned long)(msg->data+HEADER_LEN));
824 printf("Parsing RESTART Msg\n");
828 int exclusive, channel;
829 dec_ie_channel_id(restart->CHANNEL_ID, (Q931_info_t *)restart, &exclusive, &channel, nt,bc);
830 if (channel==0xff) /* any channel */
832 cb_log(0, bc->stack->port, "CC_RESTART Request on channel:%d on port:%d\n",bc->stack->port);
837 msg_t *build_restart (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
839 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
841 msg_t *msg =(msg_t*)create_l3msg(CC_RESTART | REQUEST, MT_RESTART, bc?bc->l3_id:-1, sizeof(RESTART_t) ,nt);
843 restart=(RESTART_t*)((msg->data+HEADER_LEN));
846 printf("Building RESTART Msg\n");
850 void print_restart (struct isdn_msg msgs[])
855 void parse_release (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
857 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
858 RELEASE_t *release=(RELEASE_t*)((unsigned long)(msg->data+HEADER_LEN));
861 dec_ie_cause(release->CAUSE, (Q931_info_t *)(release), &location, &bc->cause, nt,bc);
863 printf("Parsing RELEASE Msg\n");
868 msg_t *build_release (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
870 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
872 msg_t *msg =(msg_t*)create_l3msg(CC_RELEASE | REQUEST, MT_RELEASE, bc?bc->l3_id:-1, sizeof(RELEASE_t) ,nt);
874 release=(RELEASE_t*)((msg->data+HEADER_LEN));
877 enc_ie_cause(&release->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
880 printf("Building RELEASE Msg\n");
884 void print_release (struct isdn_msg msgs[])
889 void parse_release_complete (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
891 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
892 RELEASE_COMPLETE_t *release_complete=(RELEASE_COMPLETE_t*)((unsigned long)(msg->data+HEADER_LEN));
894 iframe_t *frm = (iframe_t*) msg->data;
895 #ifdef MISDNUSER_JOLLY
896 mISDNuser_head_t *hh;
897 hh=(mISDNuser_head_t*)msg->data;
900 hh=(mISDN_head_t*)msg->data;
904 if (hh->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
905 cb_log(0, bc->stack->port, "CC_RELEASE_COMPLETE|CONFIRM [NT] port:%d\n",bc->stack->port);
909 if (frm->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
910 cb_log(0, bc->stack->port, "CC_RELEASE_COMPLETE|CONFIRM [TE] port:%d\n",bc->stack->port);
914 dec_ie_cause(release_complete->CAUSE, (Q931_info_t *)(release_complete), &location, &bc->cause, nt,bc);
918 printf("Parsing RELEASE_COMPLETE Msg\n");
923 msg_t *build_release_complete (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
925 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
926 RELEASE_COMPLETE_t *release_complete;
927 msg_t *msg =(msg_t*)create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE, bc?bc->l3_id:-1, sizeof(RELEASE_COMPLETE_t) ,nt);
929 release_complete=(RELEASE_COMPLETE_t*)((msg->data+HEADER_LEN));
931 enc_ie_cause(&release_complete->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
934 printf("Building RELEASE_COMPLETE Msg\n");
938 void print_release_complete (struct isdn_msg msgs[])
943 void parse_facility (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
945 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
946 FACILITY_t *facility=(FACILITY_t*)((unsigned long)(msg->data+HEADER_LEN));
947 Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);
951 printf("Parsing FACILITY Msg\n");
958 dec_ie_facility(facility->FACILITY, qi, fac, &facility_len, nt, bc);
963 msg_t *build_facility (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
965 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
966 FACILITY_t *facility;
967 msg_t *msg =(msg_t*)create_l3msg(CC_FACILITY | REQUEST, MT_FACILITY, bc?bc->l3_id:-1, sizeof(FACILITY_t) ,nt);
969 facility=(FACILITY_t*)((msg->data+HEADER_LEN));
973 printf("Sending %s as Display\n", bc->display);
974 enc_ie_display(&facility->DISPLAY, msg, bc->display, nt,bc);
979 switch ( bc->facility ) {
980 case FACILITY_CALLDEFLECT:
981 enc_facility_calldeflect(&facility->FACILITY, msg, bc->facility_calldeflect_nr, nt, bc);
991 printf("Building FACILITY Msg\n");
995 void print_facility (struct isdn_msg msgs[])
1000 void parse_notify (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1003 printf("Parsing NOTIFY Msg\n");
1008 msg_t *build_notify (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
1010 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1012 msg_t *msg =(msg_t*)create_l3msg(CC_NOTIFY | REQUEST, MT_NOTIFY, bc?bc->l3_id:-1, sizeof(NOTIFY_t) ,nt);
1014 notify=(NOTIFY_t*)((msg->data+HEADER_LEN));
1017 printf("Building NOTIFY Msg\n");
1021 void print_notify (struct isdn_msg msgs[])
1026 void parse_status_enquiry (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1029 printf("Parsing STATUS_ENQUIRY Msg\n");
1034 msg_t *build_status_enquiry (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
1036 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1037 STATUS_ENQUIRY_t *status_enquiry;
1038 msg_t *msg =(msg_t*)create_l3msg(CC_STATUS_ENQUIRY | REQUEST, MT_STATUS_ENQUIRY, bc?bc->l3_id:-1, sizeof(STATUS_ENQUIRY_t) ,nt);
1040 status_enquiry=(STATUS_ENQUIRY_t*)((msg->data+HEADER_LEN));
1043 printf("Building STATUS_ENQUIRY Msg\n");
1047 void print_status_enquiry (struct isdn_msg msgs[])
1052 void parse_information (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1054 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1055 INFORMATION_t *information=(INFORMATION_t*)((unsigned long)(msg->data+HEADER_LEN));
1061 dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *)information, &type, &plan, (unsigned char *)number, sizeof(number), nt,bc);
1062 dec_ie_keypad(information->KEYPAD, (Q931_info_t *)information, (unsigned char *)keypad, sizeof(keypad), nt,bc);
1063 strcpy(bc->info_dad, number);
1064 strcpy(bc->keypad,keypad);
1068 printf("Parsing INFORMATION Msg\n");
1073 msg_t *build_information (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
1075 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1076 INFORMATION_t *information;
1077 msg_t *msg =(msg_t*)create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION, bc?bc->l3_id:-1, sizeof(INFORMATION_t) ,nt);
1079 information=(INFORMATION_t*)((msg->data+HEADER_LEN));
1082 enc_ie_called_pn(&information->CALLED_PN, msg, 0, 1, bc->info_dad, nt,bc);
1087 printf("Sending %s as Display\n", bc->display);
1088 enc_ie_display(&information->DISPLAY, msg, bc->display, nt,bc);
1093 printf("Building INFORMATION Msg\n");
1097 void print_information (struct isdn_msg msgs[])
1102 void parse_status (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1104 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1105 STATUS_t *status=(STATUS_t*)((unsigned long)(msg->data+HEADER_LEN));
1108 dec_ie_cause(status->CAUSE, (Q931_info_t *)(status), &location, &bc->cause, nt,bc);
1112 printf("Parsing STATUS Msg\n");
1117 msg_t *build_status (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
1119 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1121 msg_t *msg =(msg_t*)create_l3msg(CC_STATUS | REQUEST, MT_STATUS, bc?bc->l3_id:-1, sizeof(STATUS_t) ,nt);
1123 status=(STATUS_t*)((msg->data+HEADER_LEN));
1126 printf("Building STATUS Msg\n");
1130 void print_status (struct isdn_msg msgs[])
1135 void parse_timeout (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1138 printf("Parsing STATUS Msg\n");
1143 msg_t *build_timeout (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
1145 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1147 msg_t *msg =(msg_t*)create_l3msg(CC_STATUS | REQUEST, MT_STATUS, bc?bc->l3_id:-1, sizeof(STATUS_t) ,nt);
1149 status=(STATUS_t*)((msg->data+HEADER_LEN));
1152 printf("Building STATUS Msg\n");
1156 void print_timeout (struct isdn_msg msgs[])
1161 /************************************/
1168 struct isdn_msg msgs_g[] = {
1169 {CC_PROCEEDING,L3,EVENT_PROCEEDING,
1170 parse_proceeding,build_proceeding,print_proceeding,
1172 {CC_ALERTING,L3,EVENT_ALERTING,
1173 parse_alerting,build_alerting,print_alerting,
1175 {CC_PROGRESS,L3,EVENT_PROGRESS,
1176 parse_progress,build_progress,print_progress,
1178 {CC_SETUP,L3,EVENT_SETUP,
1179 parse_setup,build_setup,print_setup,
1181 {CC_CONNECT,L3,EVENT_CONNECT,
1182 parse_connect,build_connect,print_connect,
1184 {CC_SETUP_ACKNOWLEDGE,L3,EVENT_SETUP_ACKNOWLEDGE,
1185 parse_setup_acknowledge,build_setup_acknowledge,print_setup_acknowledge,
1186 "SETUP_ACKNOWLEDGE"},
1187 {CC_CONNECT_ACKNOWLEDGE ,L3,EVENT_CONNECT_ACKNOWLEDGE ,
1188 parse_connect_acknowledge ,build_connect_acknowledge ,print_connect_acknowledge ,
1189 "CONNECT_ACKNOWLEDGE "},
1190 {CC_USER_INFORMATION,L3,EVENT_USER_INFORMATION,
1191 parse_user_information,build_user_information,print_user_information,
1192 "USER_INFORMATION"},
1193 {CC_SUSPEND_REJECT,L3,EVENT_SUSPEND_REJECT,
1194 parse_suspend_reject,build_suspend_reject,print_suspend_reject,
1196 {CC_RESUME_REJECT,L3,EVENT_RESUME_REJECT,
1197 parse_resume_reject,build_resume_reject,print_resume_reject,
1199 {CC_HOLD,L3,EVENT_HOLD,
1200 parse_hold,build_hold,print_hold,
1202 {CC_SUSPEND,L3,EVENT_SUSPEND,
1203 parse_suspend,build_suspend,print_suspend,
1205 {CC_RESUME,L3,EVENT_RESUME,
1206 parse_resume,build_resume,print_resume,
1208 {CC_HOLD_ACKNOWLEDGE,L3,EVENT_HOLD_ACKNOWLEDGE,
1209 parse_hold_acknowledge,build_hold_acknowledge,print_hold_acknowledge,
1210 "HOLD_ACKNOWLEDGE"},
1211 {CC_SUSPEND_ACKNOWLEDGE,L3,EVENT_SUSPEND_ACKNOWLEDGE,
1212 parse_suspend_acknowledge,build_suspend_acknowledge,print_suspend_acknowledge,
1213 "SUSPEND_ACKNOWLEDGE"},
1214 {CC_RESUME_ACKNOWLEDGE,L3,EVENT_RESUME_ACKNOWLEDGE,
1215 parse_resume_acknowledge,build_resume_acknowledge,print_resume_acknowledge,
1216 "RESUME_ACKNOWLEDGE"},
1217 {CC_HOLD_REJECT,L3,EVENT_HOLD_REJECT,
1218 parse_hold_reject,build_hold_reject,print_hold_reject,
1220 {CC_RETRIEVE,L3,EVENT_RETRIEVE,
1221 parse_retrieve,build_retrieve,print_retrieve,
1223 {CC_RETRIEVE_ACKNOWLEDGE,L3,EVENT_RETRIEVE_ACKNOWLEDGE,
1224 parse_retrieve_acknowledge,build_retrieve_acknowledge,print_retrieve_acknowledge,
1225 "RETRIEVE_ACKNOWLEDGE"},
1226 {CC_RETRIEVE_REJECT,L3,EVENT_RETRIEVE_REJECT,
1227 parse_retrieve_reject,build_retrieve_reject,print_retrieve_reject,
1229 {CC_DISCONNECT,L3,EVENT_DISCONNECT,
1230 parse_disconnect,build_disconnect,print_disconnect,
1232 {CC_RESTART,L3,EVENT_RESTART,
1233 parse_restart,build_restart,print_restart,
1235 {CC_RELEASE,L3,EVENT_RELEASE,
1236 parse_release,build_release,print_release,
1238 {CC_RELEASE_COMPLETE,L3,EVENT_RELEASE_COMPLETE,
1239 parse_release_complete,build_release_complete,print_release_complete,
1240 "RELEASE_COMPLETE"},
1241 {CC_FACILITY,L3,EVENT_FACILITY,
1242 parse_facility,build_facility,print_facility,
1244 {CC_NOTIFY,L3,EVENT_NOTIFY,
1245 parse_notify,build_notify,print_notify,
1247 {CC_STATUS_ENQUIRY,L3,EVENT_STATUS_ENQUIRY,
1248 parse_status_enquiry,build_status_enquiry,print_status_enquiry,
1250 {CC_INFORMATION,L3,EVENT_INFORMATION,
1251 parse_information,build_information,print_information,
1253 {CC_STATUS,L3,EVENT_STATUS,
1254 parse_status,build_status,print_status,
1256 {CC_TIMEOUT,L3,EVENT_TIMEOUT,
1257 parse_timeout,build_timeout,print_timeout,
1259 {0,0,0,NULL,NULL,NULL,NULL}
1262 #define msgs_max (sizeof(msgs_g)/sizeof(struct isdn_msg))
1264 /** INTERFACE FCTS ***/
1265 int isdn_msg_get_index(struct isdn_msg msgs[], msg_t *msg, int nt)
1270 #ifdef MISDNUSER_JOLLY
1271 mISDNuser_head_t *hh = (mISDNuser_head_t*)msg->data;
1273 mISDN_head_t *hh = (mISDN_head_t*)msg->data;
1276 for (i=0; i< msgs_max -1; i++)
1277 if ( (hh->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
1280 iframe_t *frm = (iframe_t*)msg->data;
1282 for (i=0; i< msgs_max -1; i++)
1283 if ( (frm->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
1289 int isdn_msg_get_index_by_event(struct isdn_msg msgs[], enum event_e event, int nt)
1292 for (i=0; i< msgs_max; i++)
1293 if ( event == msgs[i].event) return i;
1295 cb_log(4,0, "get_index: EVENT NOT FOUND!!\n");
1300 enum event_e isdn_msg_get_event(struct isdn_msg msgs[], msg_t *msg, int nt)
1302 int i=isdn_msg_get_index(msgs, msg, nt);
1303 if(i>=0) return msgs[i].event;
1304 return EVENT_UNKNOWN;
1307 char * isdn_msg_get_info(struct isdn_msg msgs[], msg_t *msg, int nt)
1309 int i=isdn_msg_get_index(msgs, msg, nt);
1310 if(i>=0) return msgs[i].info;
1315 char EVENT_CLEAN_INFO[] = "CLEAN_UP";
1316 char EVENT_DTMF_TONE_INFO[] = "DTMF_TONE";
1317 char EVENT_NEW_L3ID_INFO[] = "NEW_L3ID";
1318 char EVENT_NEW_BC_INFO[] = "NEW_BC";
1319 char EVENT_BCHAN_DATA_INFO[] = "BCHAN_DATA";
1321 char * isdn_get_info(struct isdn_msg msgs[], enum event_e event, int nt)
1323 int i=isdn_msg_get_index_by_event(msgs, event, nt);
1325 if(i>=0) return msgs[i].info;
1327 if (event == EVENT_CLEANUP) return EVENT_CLEAN_INFO;
1328 if (event == EVENT_DTMF_TONE) return EVENT_DTMF_TONE_INFO;
1329 if (event == EVENT_NEW_L3ID) return EVENT_NEW_L3ID_INFO;
1330 if (event == EVENT_NEW_BC) return EVENT_NEW_BC_INFO;
1331 if (event == EVENT_BCHAN_DATA) return EVENT_BCHAN_DATA_INFO;
1336 int isdn_msg_parse_event(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1338 int i=isdn_msg_get_index(msgs, msg, nt);
1341 msgs[i].msg_parser(msgs, msg, bc, nt);
1345 msg_t * isdn_msg_build_event(struct isdn_msg msgs[], struct misdn_bchannel *bc, enum event_e event, int nt)
1347 int i=isdn_msg_get_index_by_event(msgs, event, nt);
1348 if(i<0) return NULL;
1350 return msgs[i].msg_builder(msgs, bc, nt);