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);
23 struct misdn_stack *stack=get_stack_by_bc(bc);
26 int exclusive, channel;
27 dec_ie_channel_id(proceeding->CHANNEL_ID, (Q931_info_t *)proceeding, &exclusive, &channel, nt,bc);
29 if (channel==0xff) /* any channel */
32 /* ALERT: is that everytime true ? */
33 if (channel > 0 && stack->mode == NT_MODE)
34 bc->channel = channel;
37 dec_ie_progress(proceeding->PROGRESS, (Q931_info_t *)proceeding, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
40 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=bc->screen;
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));
823 struct misdn_stack *stack=get_stack_by_bc(bc);
826 printf("Parsing RESTART Msg\n");
830 int exclusive, channel;
831 dec_ie_channel_id(restart->CHANNEL_ID, (Q931_info_t *)restart, &exclusive, &channel, nt,bc);
832 if (channel==0xff) /* any channel */
834 cb_log(0, stack->port, "CC_RESTART Request on channel:%d on port:%d\n",stack->port);
839 msg_t *build_restart (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
841 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
843 msg_t *msg =(msg_t*)create_l3msg(CC_RESTART | REQUEST, MT_RESTART, bc?bc->l3_id:-1, sizeof(RESTART_t) ,nt);
845 restart=(RESTART_t*)((msg->data+HEADER_LEN));
848 printf("Building RESTART Msg\n");
852 void print_restart (struct isdn_msg msgs[])
857 void parse_release (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
859 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
860 RELEASE_t *release=(RELEASE_t*)((unsigned long)(msg->data+HEADER_LEN));
863 dec_ie_cause(release->CAUSE, (Q931_info_t *)(release), &location, &bc->cause, nt,bc);
865 printf("Parsing RELEASE Msg\n");
870 msg_t *build_release (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
872 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
874 msg_t *msg =(msg_t*)create_l3msg(CC_RELEASE | REQUEST, MT_RELEASE, bc?bc->l3_id:-1, sizeof(RELEASE_t) ,nt);
876 release=(RELEASE_t*)((msg->data+HEADER_LEN));
879 enc_ie_cause(&release->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
882 printf("Building RELEASE Msg\n");
886 void print_release (struct isdn_msg msgs[])
891 void parse_release_complete (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
893 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
894 RELEASE_COMPLETE_t *release_complete=(RELEASE_COMPLETE_t*)((unsigned long)(msg->data+HEADER_LEN));
896 iframe_t *frm = (iframe_t*) msg->data;
898 struct misdn_stack *stack=get_stack_by_bc(bc);
900 #ifdef MISDNUSER_JOLLY
901 mISDNuser_head_t *hh;
902 hh=(mISDNuser_head_t*)msg->data;
905 hh=(mISDN_head_t*)msg->data;
909 if (hh->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
910 cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [NT] port:%d\n",stack->port);
914 if (frm->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
915 cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [TE] port:%d\n",stack->port);
919 dec_ie_cause(release_complete->CAUSE, (Q931_info_t *)(release_complete), &location, &bc->cause, nt,bc);
923 printf("Parsing RELEASE_COMPLETE Msg\n");
928 msg_t *build_release_complete (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
930 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
931 RELEASE_COMPLETE_t *release_complete;
932 msg_t *msg =(msg_t*)create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE, bc?bc->l3_id:-1, sizeof(RELEASE_COMPLETE_t) ,nt);
934 release_complete=(RELEASE_COMPLETE_t*)((msg->data+HEADER_LEN));
936 enc_ie_cause(&release_complete->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
939 printf("Building RELEASE_COMPLETE Msg\n");
943 void print_release_complete (struct isdn_msg msgs[])
948 void parse_facility (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
950 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
951 FACILITY_t *facility=(FACILITY_t*)((unsigned long)(msg->data+HEADER_LEN));
952 Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);
956 printf("Parsing FACILITY Msg\n");
963 dec_ie_facility(facility->FACILITY, qi, fac, &facility_len, nt, bc);
968 msg_t *build_facility (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
970 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
971 FACILITY_t *facility;
972 msg_t *msg =(msg_t*)create_l3msg(CC_FACILITY | REQUEST, MT_FACILITY, bc?bc->l3_id:-1, sizeof(FACILITY_t) ,nt);
974 facility=(FACILITY_t*)((msg->data+HEADER_LEN));
978 printf("Sending %s as Display\n", bc->display);
979 enc_ie_display(&facility->DISPLAY, msg, bc->display, nt,bc);
984 switch ( bc->facility ) {
985 case FACILITY_CALLDEFLECT:
986 enc_facility_calldeflect(&facility->FACILITY, msg, bc->facility_calldeflect_nr, nt, bc);
996 printf("Building FACILITY Msg\n");
1000 void print_facility (struct isdn_msg msgs[])
1005 void parse_notify (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1008 printf("Parsing NOTIFY Msg\n");
1013 msg_t *build_notify (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
1015 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1017 msg_t *msg =(msg_t*)create_l3msg(CC_NOTIFY | REQUEST, MT_NOTIFY, bc?bc->l3_id:-1, sizeof(NOTIFY_t) ,nt);
1019 notify=(NOTIFY_t*)((msg->data+HEADER_LEN));
1022 printf("Building NOTIFY Msg\n");
1026 void print_notify (struct isdn_msg msgs[])
1031 void parse_status_enquiry (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1034 printf("Parsing STATUS_ENQUIRY Msg\n");
1039 msg_t *build_status_enquiry (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
1041 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1042 STATUS_ENQUIRY_t *status_enquiry;
1043 msg_t *msg =(msg_t*)create_l3msg(CC_STATUS_ENQUIRY | REQUEST, MT_STATUS_ENQUIRY, bc?bc->l3_id:-1, sizeof(STATUS_ENQUIRY_t) ,nt);
1045 status_enquiry=(STATUS_ENQUIRY_t*)((msg->data+HEADER_LEN));
1048 printf("Building STATUS_ENQUIRY Msg\n");
1052 void print_status_enquiry (struct isdn_msg msgs[])
1057 void parse_information (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1059 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1060 INFORMATION_t *information=(INFORMATION_t*)((unsigned long)(msg->data+HEADER_LEN));
1066 dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *)information, &type, &plan, (unsigned char *)number, sizeof(number), nt,bc);
1067 dec_ie_keypad(information->KEYPAD, (Q931_info_t *)information, (unsigned char *)keypad, sizeof(keypad), nt,bc);
1068 strcpy(bc->info_dad, number);
1069 strcpy(bc->keypad,keypad);
1073 printf("Parsing INFORMATION Msg\n");
1078 msg_t *build_information (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
1080 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1081 INFORMATION_t *information;
1082 msg_t *msg =(msg_t*)create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION, bc?bc->l3_id:-1, sizeof(INFORMATION_t) ,nt);
1084 information=(INFORMATION_t*)((msg->data+HEADER_LEN));
1087 enc_ie_called_pn(&information->CALLED_PN, msg, 0, 1, bc->info_dad, nt,bc);
1092 printf("Sending %s as Display\n", bc->display);
1093 enc_ie_display(&information->DISPLAY, msg, bc->display, nt,bc);
1098 printf("Building INFORMATION Msg\n");
1102 void print_information (struct isdn_msg msgs[])
1107 void parse_status (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1109 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1110 STATUS_t *status=(STATUS_t*)((unsigned long)(msg->data+HEADER_LEN));
1113 dec_ie_cause(status->CAUSE, (Q931_info_t *)(status), &location, &bc->cause, nt,bc);
1117 printf("Parsing STATUS Msg\n");
1122 msg_t *build_status (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
1124 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1126 msg_t *msg =(msg_t*)create_l3msg(CC_STATUS | REQUEST, MT_STATUS, bc?bc->l3_id:-1, sizeof(STATUS_t) ,nt);
1128 status=(STATUS_t*)((msg->data+HEADER_LEN));
1131 printf("Building STATUS Msg\n");
1135 void print_status (struct isdn_msg msgs[])
1140 void parse_timeout (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1143 printf("Parsing STATUS Msg\n");
1148 msg_t *build_timeout (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
1150 int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
1152 msg_t *msg =(msg_t*)create_l3msg(CC_STATUS | REQUEST, MT_STATUS, bc?bc->l3_id:-1, sizeof(STATUS_t) ,nt);
1154 status=(STATUS_t*)((msg->data+HEADER_LEN));
1157 printf("Building STATUS Msg\n");
1161 void print_timeout (struct isdn_msg msgs[])
1166 /************************************/
1173 struct isdn_msg msgs_g[] = {
1174 {CC_PROCEEDING,L3,EVENT_PROCEEDING,
1175 parse_proceeding,build_proceeding,print_proceeding,
1177 {CC_ALERTING,L3,EVENT_ALERTING,
1178 parse_alerting,build_alerting,print_alerting,
1180 {CC_PROGRESS,L3,EVENT_PROGRESS,
1181 parse_progress,build_progress,print_progress,
1183 {CC_SETUP,L3,EVENT_SETUP,
1184 parse_setup,build_setup,print_setup,
1186 {CC_CONNECT,L3,EVENT_CONNECT,
1187 parse_connect,build_connect,print_connect,
1189 {CC_SETUP_ACKNOWLEDGE,L3,EVENT_SETUP_ACKNOWLEDGE,
1190 parse_setup_acknowledge,build_setup_acknowledge,print_setup_acknowledge,
1191 "SETUP_ACKNOWLEDGE"},
1192 {CC_CONNECT_ACKNOWLEDGE ,L3,EVENT_CONNECT_ACKNOWLEDGE ,
1193 parse_connect_acknowledge ,build_connect_acknowledge ,print_connect_acknowledge ,
1194 "CONNECT_ACKNOWLEDGE "},
1195 {CC_USER_INFORMATION,L3,EVENT_USER_INFORMATION,
1196 parse_user_information,build_user_information,print_user_information,
1197 "USER_INFORMATION"},
1198 {CC_SUSPEND_REJECT,L3,EVENT_SUSPEND_REJECT,
1199 parse_suspend_reject,build_suspend_reject,print_suspend_reject,
1201 {CC_RESUME_REJECT,L3,EVENT_RESUME_REJECT,
1202 parse_resume_reject,build_resume_reject,print_resume_reject,
1204 {CC_HOLD,L3,EVENT_HOLD,
1205 parse_hold,build_hold,print_hold,
1207 {CC_SUSPEND,L3,EVENT_SUSPEND,
1208 parse_suspend,build_suspend,print_suspend,
1210 {CC_RESUME,L3,EVENT_RESUME,
1211 parse_resume,build_resume,print_resume,
1213 {CC_HOLD_ACKNOWLEDGE,L3,EVENT_HOLD_ACKNOWLEDGE,
1214 parse_hold_acknowledge,build_hold_acknowledge,print_hold_acknowledge,
1215 "HOLD_ACKNOWLEDGE"},
1216 {CC_SUSPEND_ACKNOWLEDGE,L3,EVENT_SUSPEND_ACKNOWLEDGE,
1217 parse_suspend_acknowledge,build_suspend_acknowledge,print_suspend_acknowledge,
1218 "SUSPEND_ACKNOWLEDGE"},
1219 {CC_RESUME_ACKNOWLEDGE,L3,EVENT_RESUME_ACKNOWLEDGE,
1220 parse_resume_acknowledge,build_resume_acknowledge,print_resume_acknowledge,
1221 "RESUME_ACKNOWLEDGE"},
1222 {CC_HOLD_REJECT,L3,EVENT_HOLD_REJECT,
1223 parse_hold_reject,build_hold_reject,print_hold_reject,
1225 {CC_RETRIEVE,L3,EVENT_RETRIEVE,
1226 parse_retrieve,build_retrieve,print_retrieve,
1228 {CC_RETRIEVE_ACKNOWLEDGE,L3,EVENT_RETRIEVE_ACKNOWLEDGE,
1229 parse_retrieve_acknowledge,build_retrieve_acknowledge,print_retrieve_acknowledge,
1230 "RETRIEVE_ACKNOWLEDGE"},
1231 {CC_RETRIEVE_REJECT,L3,EVENT_RETRIEVE_REJECT,
1232 parse_retrieve_reject,build_retrieve_reject,print_retrieve_reject,
1234 {CC_DISCONNECT,L3,EVENT_DISCONNECT,
1235 parse_disconnect,build_disconnect,print_disconnect,
1237 {CC_RESTART,L3,EVENT_RESTART,
1238 parse_restart,build_restart,print_restart,
1240 {CC_RELEASE,L3,EVENT_RELEASE,
1241 parse_release,build_release,print_release,
1243 {CC_RELEASE_COMPLETE,L3,EVENT_RELEASE_COMPLETE,
1244 parse_release_complete,build_release_complete,print_release_complete,
1245 "RELEASE_COMPLETE"},
1246 {CC_FACILITY,L3,EVENT_FACILITY,
1247 parse_facility,build_facility,print_facility,
1249 {CC_NOTIFY,L3,EVENT_NOTIFY,
1250 parse_notify,build_notify,print_notify,
1252 {CC_STATUS_ENQUIRY,L3,EVENT_STATUS_ENQUIRY,
1253 parse_status_enquiry,build_status_enquiry,print_status_enquiry,
1255 {CC_INFORMATION,L3,EVENT_INFORMATION,
1256 parse_information,build_information,print_information,
1258 {CC_STATUS,L3,EVENT_STATUS,
1259 parse_status,build_status,print_status,
1261 {CC_TIMEOUT,L3,EVENT_TIMEOUT,
1262 parse_timeout,build_timeout,print_timeout,
1264 {0,0,0,NULL,NULL,NULL,NULL}
1267 #define msgs_max (sizeof(msgs_g)/sizeof(struct isdn_msg))
1269 /** INTERFACE FCTS ***/
1270 int isdn_msg_get_index(struct isdn_msg msgs[], msg_t *msg, int nt)
1275 #ifdef MISDNUSER_JOLLY
1276 mISDNuser_head_t *hh = (mISDNuser_head_t*)msg->data;
1278 mISDN_head_t *hh = (mISDN_head_t*)msg->data;
1281 for (i=0; i< msgs_max -1; i++)
1282 if ( (hh->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
1285 iframe_t *frm = (iframe_t*)msg->data;
1287 for (i=0; i< msgs_max -1; i++)
1288 if ( (frm->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
1294 int isdn_msg_get_index_by_event(struct isdn_msg msgs[], enum event_e event, int nt)
1297 for (i=0; i< msgs_max; i++)
1298 if ( event == msgs[i].event) return i;
1300 cb_log(4,0, "get_index: EVENT NOT FOUND!!\n");
1305 enum event_e isdn_msg_get_event(struct isdn_msg msgs[], msg_t *msg, int nt)
1307 int i=isdn_msg_get_index(msgs, msg, nt);
1308 if(i>=0) return msgs[i].event;
1309 return EVENT_UNKNOWN;
1312 char * isdn_msg_get_info(struct isdn_msg msgs[], msg_t *msg, int nt)
1314 int i=isdn_msg_get_index(msgs, msg, nt);
1315 if(i>=0) return msgs[i].info;
1320 char EVENT_CLEAN_INFO[] = "CLEAN_UP";
1321 char EVENT_DTMF_TONE_INFO[] = "DTMF_TONE";
1322 char EVENT_NEW_L3ID_INFO[] = "NEW_L3ID";
1323 char EVENT_NEW_BC_INFO[] = "NEW_BC";
1324 char EVENT_BCHAN_DATA_INFO[] = "BCHAN_DATA";
1326 char * isdn_get_info(struct isdn_msg msgs[], enum event_e event, int nt)
1328 int i=isdn_msg_get_index_by_event(msgs, event, nt);
1330 if(i>=0) return msgs[i].info;
1332 if (event == EVENT_CLEANUP) return EVENT_CLEAN_INFO;
1333 if (event == EVENT_DTMF_TONE) return EVENT_DTMF_TONE_INFO;
1334 if (event == EVENT_NEW_L3ID) return EVENT_NEW_L3ID_INFO;
1335 if (event == EVENT_NEW_BC) return EVENT_NEW_BC_INFO;
1336 if (event == EVENT_BCHAN_DATA) return EVENT_BCHAN_DATA_INFO;
1341 int isdn_msg_parse_event(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
1343 int i=isdn_msg_get_index(msgs, msg, nt);
1346 msgs[i].msg_parser(msgs, msg, bc, nt);
1350 msg_t * isdn_msg_build_event(struct isdn_msg msgs[], struct misdn_bchannel *bc, enum event_e event, int nt)
1352 int i=isdn_msg_get_index_by_event(msgs, event, nt);
1353 if(i<0) return NULL;
1355 return msgs[i].msg_builder(msgs, bc, nt);