Mon Apr 30 07:43:53 2007

Asterisk developer's documentation


isdn_msg_parser.c File Reference

#include "isdn_lib_intern.h"
#include "isdn_lib.h"
#include "ie.c"

Include dependency graph for isdn_msg_parser.c:

Go to the source code of this file.

Defines

#define ANY_CHANNEL   0xff
#define msgs_max   (sizeof(msgs_g)/sizeof(struct isdn_msg))

Functions

static msg_t * build_alerting (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_connect (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)
static msg_t * build_disconnect (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_facility (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_hold (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 msg_t * build_hold_reject (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_information (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_notify (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_proceeding (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)
static msg_t * build_release (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)
static msg_t * build_restart (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_resume (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_resume_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_resume_reject (struct isdn_msg msgs[], 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_retrieve_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_retrieve_reject (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 msg_t * build_setup_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_status (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_status_enquiry (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_suspend (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_suspend_acknowledge (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_suspend_reject (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_timeout (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
static msg_t * build_user_information (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
char * isdn_get_info (struct isdn_msg msgs[], enum event_e event, int nt)
msg_t * isdn_msg_build_event (struct isdn_msg msgs[], struct misdn_bchannel *bc, enum event_e event, int nt)
enum event_e isdn_msg_get_event (struct isdn_msg msgs[], msg_t *msg, int nt)
int isdn_msg_get_index (struct isdn_msg msgs[], msg_t *msg, int nt)
int isdn_msg_get_index_by_event (struct isdn_msg msgs[], enum event_e event, int nt)
char * isdn_msg_get_info (struct isdn_msg msgs[], msg_t *msg, int nt)
int isdn_msg_parse_event (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_alerting (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_connect (struct isdn_msg msgs[], msg_t *msg, 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 void parse_disconnect (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_facility (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_hold (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 parse_hold_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_information (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 parse_proceeding (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 void parse_release (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_release_complete (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_restart (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_resume (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_resume_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_resume_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_retrieve (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_retrieve_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_retrieve_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_setup (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_setup_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_status (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)
static void parse_suspend (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_suspend_acknowledge (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_suspend_reject (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_timeout (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void parse_user_information (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt)
static void set_channel (struct misdn_bchannel *bc, int channel)

Variables

char EVENT_BCHAN_ACTIVATED_INFO [] = "BCHAN_ACTIVATED"
char EVENT_BCHAN_DATA_INFO [] = "BCHAN_DATA"
char EVENT_BCHAN_ERROR_INFO [] = "BCHAN_ERROR"
char EVENT_CLEAN_INFO [] = "CLEAN_UP"
char EVENT_DTMF_TONE_INFO [] = "DTMF_TONE"
char EVENT_NEW_BC_INFO [] = "NEW_BC"
char EVENT_NEW_CHANNEL_INFO [] = "NEW_CHANNEL"
char EVENT_NEW_L3ID_INFO [] = "NEW_L3ID"
char EVENT_PORT_ALARM_INFO [] = "ALARM"
char EVENT_TONE_GENERATE_INFO [] = "TONE_GENERATE"
isdn_msg msgs_g []


Define Documentation

#define ANY_CHANNEL   0xff

Definition at line 268 of file isdn_msg_parser.c.

Referenced by build_setup().

#define msgs_max   (sizeof(msgs_g)/sizeof(struct isdn_msg))

Definition at line 1230 of file isdn_msg_parser.c.

Referenced by isdn_msg_get_index(), and isdn_msg_get_index_by_event().


Function Documentation

static msg_t* build_alerting ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 107 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::channel, create_l3msg(), enc_ie_channel_id(), enc_ie_progress(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00108 {
00109    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00110    ALERTING_t *alerting;
00111    msg_t *msg =(msg_t*)create_l3msg(CC_ALERTING | REQUEST, MT_ALERTING,  bc?bc->l3_id:-1, sizeof(ALERTING_t) ,nt); 
00112   
00113    alerting=(ALERTING_t*)((msg->data+HEADER_LEN)); 
00114   
00115    enc_ie_channel_id(&alerting->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
00116    
00117    if (nt) 
00118       enc_ie_progress(&alerting->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
00119 #if DEBUG 
00120    printf("Building ALERTING Msg\n"); 
00121 #endif
00122    return msg; 
00123 }

static msg_t* build_connect ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 379 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::cad, cb_log, misdn_bchannel::cpnnumplan, create_l3msg(), enc_ie_connected_pn(), enc_ie_date(), HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, misdn_bchannel::port, and type.

00380 {
00381    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00382    CONNECT_t *connect;
00383    msg_t *msg =(msg_t*)create_l3msg(CC_CONNECT | REQUEST, MT_CONNECT,  bc?bc->l3_id:-1, sizeof(CONNECT_t) ,nt); 
00384    
00385    cb_log(6,bc->port,"BUILD_CONNECT: bc:%p bc->l3id:%d, nt:%d\n",bc,bc->l3_id,nt);
00386 
00387    connect=(CONNECT_t*)((msg->data+HEADER_LEN)); 
00388 
00389    if (nt) {
00390       time_t now;
00391       time(&now);
00392       enc_ie_date(&connect->DATE, msg, now, nt,bc);
00393    }
00394   
00395    {
00396       int type=bc->cpnnumplan, plan=1, present=2, screen=0;
00397       enc_ie_connected_pn(&connect->CONNECT_PN, msg, type,plan, present, screen, bc->cad, nt , bc);
00398    }
00399 
00400 #if DEBUG 
00401    printf("Building CONNECT Msg\n"); 
00402 #endif
00403    return msg; 
00404 }

static msg_t* build_connect_acknowledge ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 455 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::channel, create_l3msg(), enc_ie_channel_id(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00456 {
00457    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00458    CONNECT_ACKNOWLEDGE_t *connect_acknowledge;
00459    msg_t *msg =(msg_t*)create_l3msg(CC_CONNECT | RESPONSE, MT_CONNECT,  bc?bc->l3_id:-1, sizeof(CONNECT_ACKNOWLEDGE_t) ,nt); 
00460  
00461    connect_acknowledge=(CONNECT_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00462   
00463    enc_ie_channel_id(&connect_acknowledge->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
00464   
00465 #if DEBUG 
00466    printf("Building CONNECT_ACKNOWLEDGE Msg\n"); 
00467 #endif
00468    return msg; 
00469 }

static msg_t* build_disconnect ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 788 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), enc_ie_cause(), enc_ie_progress(), HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, and misdn_bchannel::out_cause.

00789 {
00790    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00791    DISCONNECT_t *disconnect;
00792    msg_t *msg =(msg_t*)create_l3msg(CC_DISCONNECT | REQUEST, MT_DISCONNECT,  bc?bc->l3_id:-1, sizeof(DISCONNECT_t) ,nt); 
00793    
00794    disconnect=(DISCONNECT_t*)((msg->data+HEADER_LEN)); 
00795    
00796    enc_ie_cause(&disconnect->CAUSE, msg, (nt)?1:0, bc->out_cause,nt,bc);
00797    if (nt) enc_ie_progress(&disconnect->PROGRESS, msg, 0, nt?1:5, 8 ,nt,bc);
00798   
00799 #if DEBUG 
00800    printf("Building DISCONNECT Msg\n"); 
00801 #endif
00802    return msg; 
00803 }

static msg_t* build_facility ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 956 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), misdn_bchannel::display, enc_ie_display(), misdn_bchannel::fac_out, HEADER_LEN, misdn_bchannel::l3_id, len, mISDNUSER_HEAD_SIZE, and misdn_bchannel::nt.

00957 {
00958    int len,
00959       HEADER_LEN = nt ? mISDNUSER_HEAD_SIZE : mISDN_HEADER_LEN;
00960    unsigned char *ie_fac,
00961               fac_tmp[256];
00962    msg_t *msg =(msg_t*)create_l3msg(CC_FACILITY | REQUEST, MT_FACILITY,  bc?bc->l3_id:-1, sizeof(FACILITY_t) ,nt);
00963    FACILITY_t *facility = (FACILITY_t*)(msg->data+HEADER_LEN); 
00964    Q931_info_t *qi;
00965 
00966 #if DEBUG 
00967    printf("Building FACILITY Msg\n"); 
00968 #endif
00969    
00970    len = encodeFac(fac_tmp, &(bc->fac_out));
00971    if (len <= 0)
00972       return NULL;
00973 
00974    ie_fac = msg_put(msg, len);
00975    if (bc->nt) {
00976       facility->FACILITY = ie_fac + 1;
00977    } else {
00978       qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
00979       qi->QI_ELEMENT(facility) = ie_fac - (unsigned char *)qi - sizeof(Q931_info_t);
00980    }
00981 
00982    memcpy(ie_fac, fac_tmp, len);
00983 
00984    if (*bc->display) {
00985       printf("Sending %s as Display\n", bc->display);
00986       enc_ie_display(&facility->DISPLAY, msg, bc->display, nt,bc);
00987    }
00988 
00989    return msg; 
00990 }

static msg_t* build_hold ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 549 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00550 {
00551    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00552    HOLD_t *hold;
00553    msg_t *msg =(msg_t*)create_l3msg(CC_HOLD | REQUEST, MT_HOLD,  bc?bc->l3_id:-1, sizeof(HOLD_t) ,nt); 
00554  
00555    hold=(HOLD_t*)((msg->data+HEADER_LEN)); 
00556 
00557 #if DEBUG 
00558    printf("Building HOLD Msg\n"); 
00559 #endif
00560    return msg; 
00561 }

static msg_t* build_hold_acknowledge ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 618 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00619 {
00620    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00621    HOLD_ACKNOWLEDGE_t *hold_acknowledge;
00622    msg_t *msg =(msg_t*)create_l3msg(CC_HOLD_ACKNOWLEDGE | REQUEST, MT_HOLD_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(HOLD_ACKNOWLEDGE_t) ,nt); 
00623  
00624    hold_acknowledge=(HOLD_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00625 
00626 #if DEBUG 
00627    printf("Building HOLD_ACKNOWLEDGE Msg\n"); 
00628 #endif
00629    return msg; 
00630 }

static msg_t* build_hold_reject ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 687 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00688 {
00689    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00690    HOLD_REJECT_t *hold_reject;
00691    msg_t *msg =(msg_t*)create_l3msg(CC_HOLD_REJECT | REQUEST, MT_HOLD_REJECT,  bc?bc->l3_id:-1, sizeof(HOLD_REJECT_t) ,nt); 
00692  
00693    hold_reject=(HOLD_REJECT_t*)((msg->data+HEADER_LEN)); 
00694 
00695 #if DEBUG 
00696    printf("Building HOLD_REJECT Msg\n"); 
00697 #endif
00698    return msg; 
00699 }

static msg_t* build_information ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 1052 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), misdn_bchannel::display, enc_ie_called_pn(), enc_ie_display(), HEADER_LEN, misdn_bchannel::info_dad, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

01053 {
01054    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01055    INFORMATION_t *information;
01056    msg_t *msg =(msg_t*)create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION,  bc?bc->l3_id:-1, sizeof(INFORMATION_t) ,nt); 
01057  
01058    information=(INFORMATION_t*)((msg->data+HEADER_LEN)); 
01059   
01060    {
01061       enc_ie_called_pn(&information->CALLED_PN, msg, 0, 1, bc->info_dad, nt,bc);
01062    }
01063 
01064    {
01065       if (*bc->display) {
01066          printf("Sending %s as Display\n", bc->display);
01067          enc_ie_display(&information->DISPLAY, msg, bc->display, nt,bc);
01068       }
01069    }
01070   
01071 #if DEBUG 
01072    printf("Building INFORMATION Msg\n"); 
01073 #endif
01074    return msg; 
01075 }

static msg_t* build_notify ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 999 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

01000 {
01001    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01002    NOTIFY_t *notify;
01003    msg_t *msg =(msg_t*)create_l3msg(CC_NOTIFY | REQUEST, MT_NOTIFY,  bc?bc->l3_id:-1, sizeof(NOTIFY_t) ,nt); 
01004  
01005    notify=(NOTIFY_t*)((msg->data+HEADER_LEN)); 
01006 
01007 #if DEBUG 
01008    printf("Building NOTIFY Msg\n"); 
01009 #endif
01010    return msg; 
01011 }

static msg_t* build_proceeding ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 72 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::channel, create_l3msg(), enc_ie_channel_id(), enc_ie_progress(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00073 {
00074    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00075    CALL_PROCEEDING_t *proceeding;
00076    msg_t *msg =(msg_t*)create_l3msg(CC_PROCEEDING | REQUEST, MT_CALL_PROCEEDING,  bc?bc->l3_id:-1, sizeof(CALL_PROCEEDING_t) ,nt); 
00077   
00078    proceeding=(CALL_PROCEEDING_t*)((msg->data+HEADER_LEN));
00079 
00080    enc_ie_channel_id(&proceeding->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
00081   
00082    if (nt) 
00083       enc_ie_progress(&proceeding->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
00084   
00085 
00086 #if DEBUG 
00087    printf("Building PROCEEDING Msg\n"); 
00088 #endif
00089    return msg; 
00090 }

static msg_t* build_progress ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 139 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00140 {
00141    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00142    PROGRESS_t *progress;
00143    msg_t *msg =(msg_t*)create_l3msg(CC_PROGRESS | REQUEST, MT_PROGRESS,  bc?bc->l3_id:-1, sizeof(PROGRESS_t) ,nt); 
00144  
00145    progress=(PROGRESS_t*)((msg->data+HEADER_LEN)); 
00146 
00147 #if DEBUG 
00148    printf("Building PROGRESS Msg\n"); 
00149 #endif
00150    return msg; 
00151 }

static msg_t* build_release ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 862 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), enc_ie_cause(), HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, and misdn_bchannel::out_cause.

00863 {
00864    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00865    RELEASE_t *release;
00866    msg_t *msg =(msg_t*)create_l3msg(CC_RELEASE | REQUEST, MT_RELEASE,  bc?bc->l3_id:-1, sizeof(RELEASE_t) ,nt); 
00867  
00868    release=(RELEASE_t*)((msg->data+HEADER_LEN)); 
00869   
00870    if (bc->out_cause>= 0)
00871       enc_ie_cause(&release->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
00872   
00873 #if DEBUG 
00874    printf("Building RELEASE Msg\n"); 
00875 #endif
00876    return msg; 
00877 }

static msg_t* build_release_complete ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 913 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), enc_ie_cause(), HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, and misdn_bchannel::out_cause.

00914 {
00915    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00916    RELEASE_COMPLETE_t *release_complete;
00917    msg_t *msg =(msg_t*)create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE,  bc?bc->l3_id:-1, sizeof(RELEASE_COMPLETE_t) ,nt); 
00918  
00919    release_complete=(RELEASE_COMPLETE_t*)((msg->data+HEADER_LEN)); 
00920    
00921    enc_ie_cause(&release_complete->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
00922   
00923 #if DEBUG 
00924    printf("Building RELEASE_COMPLETE Msg\n"); 
00925 #endif
00926    return msg; 
00927 }

static msg_t* build_restart ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 828 of file isdn_msg_parser.c.

References misdn_stack::bc, cb_log, misdn_bchannel::channel, create_l3msg(), enc_ie_channel_id(), HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, and misdn_bchannel::port.

00829 {
00830    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00831    RESTART_t *restart;
00832    msg_t *msg =(msg_t*)create_l3msg(CC_RESTART | REQUEST, MT_RESTART,  bc?bc->l3_id:-1, sizeof(RESTART_t) ,nt); 
00833  
00834    restart=(RESTART_t*)((msg->data+HEADER_LEN)); 
00835    
00836 #if DEBUG 
00837    printf("Building RESTART Msg\n"); 
00838 #endif
00839    enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
00840 
00841    cb_log(0,bc->port, "Restarting channel %d\n", bc->channel);
00842    
00843    return msg; 
00844 }

static msg_t* build_resume ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 595 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00596 {
00597    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00598    RESUME_t *resume;
00599    msg_t *msg =(msg_t*)create_l3msg(CC_RESUME | REQUEST, MT_RESUME,  bc?bc->l3_id:-1, sizeof(RESUME_t) ,nt); 
00600  
00601    resume=(RESUME_t*)((msg->data+HEADER_LEN)); 
00602 
00603 #if DEBUG 
00604    printf("Building RESUME Msg\n"); 
00605 #endif
00606    return msg; 
00607 }

static msg_t* build_resume_acknowledge ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 664 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00665 {
00666    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00667    RESUME_ACKNOWLEDGE_t *resume_acknowledge;
00668    msg_t *msg =(msg_t*)create_l3msg(CC_RESUME_ACKNOWLEDGE | REQUEST, MT_RESUME_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(RESUME_ACKNOWLEDGE_t) ,nt); 
00669  
00670    resume_acknowledge=(RESUME_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00671 
00672 #if DEBUG 
00673    printf("Building RESUME_ACKNOWLEDGE Msg\n"); 
00674 #endif
00675    return msg; 
00676 }

static msg_t* build_resume_reject ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 526 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00527 {
00528    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00529    RESUME_REJECT_t *resume_reject;
00530    msg_t *msg =(msg_t*)create_l3msg(CC_RESUME_REJECT | REQUEST, MT_RESUME_REJECT,  bc?bc->l3_id:-1, sizeof(RESUME_REJECT_t) ,nt); 
00531  
00532    resume_reject=(RESUME_REJECT_t*)((msg->data+HEADER_LEN)); 
00533 
00534 #if DEBUG 
00535    printf("Building RESUME_REJECT Msg\n"); 
00536 #endif
00537    return msg; 
00538 }

static msg_t* build_retrieve ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 710 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00711 {
00712    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00713    RETRIEVE_t *retrieve;
00714    msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE | REQUEST, MT_RETRIEVE,  bc?bc->l3_id:-1, sizeof(RETRIEVE_t) ,nt); 
00715  
00716    retrieve=(RETRIEVE_t*)((msg->data+HEADER_LEN)); 
00717 
00718 #if DEBUG 
00719    printf("Building RETRIEVE Msg\n"); 
00720 #endif
00721    return msg; 
00722 }

static msg_t* build_retrieve_acknowledge ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 733 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::channel, create_l3msg(), enc_ie_channel_id(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00734 {
00735    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00736    RETRIEVE_ACKNOWLEDGE_t *retrieve_acknowledge;
00737    msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE_ACKNOWLEDGE | REQUEST, MT_RETRIEVE_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(RETRIEVE_ACKNOWLEDGE_t) ,nt); 
00738  
00739    retrieve_acknowledge=(RETRIEVE_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00740 
00741    enc_ie_channel_id(&retrieve_acknowledge->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
00742 #if DEBUG 
00743    printf("Building RETRIEVE_ACKNOWLEDGE Msg\n"); 
00744 #endif
00745    return msg; 
00746 }

static msg_t* build_retrieve_reject ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 757 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00758 {
00759    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00760    RETRIEVE_REJECT_t *retrieve_reject;
00761    msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE_REJECT | REQUEST, MT_RETRIEVE_REJECT,  bc?bc->l3_id:-1, sizeof(RETRIEVE_REJECT_t) ,nt); 
00762  
00763    retrieve_reject=(RETRIEVE_REJECT_t*)((msg->data+HEADER_LEN)); 
00764 
00765 #if DEBUG 
00766    printf("Building RETRIEVE_REJECT Msg\n"); 
00767 #endif
00768    return msg; 
00769 }

static msg_t* build_setup ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 269 of file isdn_msg_parser.c.

References ANY_CHANNEL, misdn_stack::bc, misdn_bchannel::capability, capability, cb_log, misdn_bchannel::channel, create_l3msg(), misdn_bchannel::dad, misdn_bchannel::display, misdn_bchannel::dnumplan, enc_ie_bearer(), enc_ie_called_pn(), enc_ie_calling_pn(), enc_ie_channel_id(), enc_ie_complete(), enc_ie_display(), enc_ie_redir_nr(), enc_ie_useruser(), HEADER_LEN, INFO_CAPABILITY_DIGITAL_RESTRICTED, INFO_CAPABILITY_DIGITAL_UNRESTRICTED, INFO_CAPABILITY_SPEECH, INFO_CODEC_ALAW, INFO_CODEC_ULAW, misdn_bchannel::l3_id, misdn_bchannel::law, mISDNUSER_HEAD_SIZE, misdn_bchannel::mode, misdn_bchannel::oad, misdn_bchannel::onumplan, misdn_bchannel::port, misdn_bchannel::pres, misdn_bchannel::rad, misdn_bchannel::rate, misdn_bchannel::screen, misdn_bchannel::sending_complete, type, misdn_bchannel::uu, and misdn_bchannel::uulen.

00270 {
00271    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00272    SETUP_t *setup;
00273    msg_t *msg =(msg_t*)create_l3msg(CC_SETUP | REQUEST, MT_SETUP,  bc?bc->l3_id:-1, sizeof(SETUP_t) ,nt); 
00274   
00275    setup=(SETUP_t*)((msg->data+HEADER_LEN)); 
00276   
00277    if (bc->channel == 0 || bc->channel == ANY_CHANNEL || bc->channel==-1)
00278       enc_ie_channel_id(&setup->CHANNEL_ID, msg, 0, bc->channel, nt,bc);
00279    else 
00280       enc_ie_channel_id(&setup->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
00281    
00282    
00283    {
00284       int type=bc->onumplan,plan=1,present=bc->pres,screen=bc->screen;
00285       enc_ie_calling_pn(&setup->CALLING_PN, msg, type, plan, present,
00286               screen, bc->oad, nt, bc);
00287    }
00288   
00289    {
00290       if (bc->dad[0])
00291          enc_ie_called_pn(&setup->CALLED_PN, msg, bc->dnumplan, 1, bc->dad, nt,bc);
00292    }
00293 
00294    {
00295       if (bc->rad[0])
00296          enc_ie_redir_nr(&setup->REDIR_NR, msg, 1, 1,  bc->pres, bc->screen, 0, bc->rad, nt,bc);
00297    }
00298 
00299    
00300   
00301    if (*bc->display) {
00302       enc_ie_display(&setup->DISPLAY, msg, bc->display, nt,bc);
00303    }
00304   
00305    {
00306       int coding=0, capability, mode=0 /*  2 for packet ! */
00307          ,user, rate=0x10;
00308 
00309       switch (bc->law) {
00310       case INFO_CODEC_ULAW: user=2;
00311          break;
00312       case INFO_CODEC_ALAW: user=3;
00313          break;
00314       default:
00315          user=3;
00316       }
00317       
00318       switch (bc->capability) {
00319       case INFO_CAPABILITY_SPEECH: capability = 0;
00320          break;
00321       case INFO_CAPABILITY_DIGITAL_UNRESTRICTED: capability = 8;
00322          user=-1;
00323          mode=bc->mode;
00324          rate=bc->rate;
00325          break;
00326       case INFO_CAPABILITY_DIGITAL_RESTRICTED: capability = 9;
00327          user=-1;
00328          break;
00329       default:
00330          capability=bc->capability; 
00331       }
00332       
00333       
00334     
00335       enc_ie_bearer(&setup->BEARER, msg, coding, capability, mode, rate, -1, user, nt,bc);
00336    }
00337 
00338    if (bc->sending_complete) {
00339       enc_ie_complete(&setup->BEARER,msg, bc->sending_complete, nt, bc);
00340    }
00341   
00342    {
00343       int  protocol=4;
00344       enc_ie_useruser(&setup->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
00345       if (bc->uulen) cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
00346       else
00347       cb_log(1,bc->port,"NO USERUESRINFO ENCODED\n");
00348    }
00349 
00350 #if DEBUG 
00351    printf("Building SETUP Msg\n"); 
00352 #endif
00353    return msg; 
00354 }

static msg_t* build_setup_acknowledge ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 427 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::channel, create_l3msg(), enc_ie_channel_id(), enc_ie_progress(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00428 {
00429    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00430    SETUP_ACKNOWLEDGE_t *setup_acknowledge;
00431    msg_t *msg =(msg_t*)create_l3msg(CC_SETUP_ACKNOWLEDGE | REQUEST, MT_SETUP_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(SETUP_ACKNOWLEDGE_t) ,nt); 
00432  
00433    setup_acknowledge=(SETUP_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00434   
00435    enc_ie_channel_id(&setup_acknowledge->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
00436   
00437    if (nt) 
00438       enc_ie_progress(&setup_acknowledge->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
00439   
00440 #if DEBUG 
00441    printf("Building SETUP_ACKNOWLEDGE Msg\n"); 
00442 #endif
00443    return msg; 
00444 }

static msg_t* build_status ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 1093 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

01094 {
01095    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01096    STATUS_t *status;
01097    msg_t *msg =(msg_t*)create_l3msg(CC_STATUS | REQUEST, MT_STATUS,  bc?bc->l3_id:-1, sizeof(STATUS_t) ,nt); 
01098  
01099    status=(STATUS_t*)((msg->data+HEADER_LEN)); 
01100 
01101 #if DEBUG 
01102    printf("Building STATUS Msg\n"); 
01103 #endif
01104    return msg; 
01105 }

static msg_t* build_status_enquiry ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 1020 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

01021 {
01022    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01023    STATUS_ENQUIRY_t *status_enquiry;
01024    msg_t *msg =(msg_t*)create_l3msg(CC_STATUS_ENQUIRY | REQUEST, MT_STATUS_ENQUIRY,  bc?bc->l3_id:-1, sizeof(STATUS_ENQUIRY_t) ,nt); 
01025  
01026    status_enquiry=(STATUS_ENQUIRY_t*)((msg->data+HEADER_LEN)); 
01027 
01028 #if DEBUG 
01029    printf("Building STATUS_ENQUIRY Msg\n"); 
01030 #endif
01031    return msg; 
01032 }

static msg_t* build_suspend ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 572 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00573 {
00574    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00575    SUSPEND_t *suspend;
00576    msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND | REQUEST, MT_SUSPEND,  bc?bc->l3_id:-1, sizeof(SUSPEND_t) ,nt); 
00577  
00578    suspend=(SUSPEND_t*)((msg->data+HEADER_LEN)); 
00579 
00580 #if DEBUG 
00581    printf("Building SUSPEND Msg\n"); 
00582 #endif
00583    return msg; 
00584 }

static msg_t* build_suspend_acknowledge ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 641 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00642 {
00643    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00644    SUSPEND_ACKNOWLEDGE_t *suspend_acknowledge;
00645    msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND_ACKNOWLEDGE | REQUEST, MT_SUSPEND_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(SUSPEND_ACKNOWLEDGE_t) ,nt); 
00646  
00647    suspend_acknowledge=(SUSPEND_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00648 
00649 #if DEBUG 
00650    printf("Building SUSPEND_ACKNOWLEDGE Msg\n"); 
00651 #endif
00652    return msg; 
00653 }

static msg_t* build_suspend_reject ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 503 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00504 {
00505    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00506    SUSPEND_REJECT_t *suspend_reject;
00507    msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND_REJECT | REQUEST, MT_SUSPEND_REJECT,  bc?bc->l3_id:-1, sizeof(SUSPEND_REJECT_t) ,nt); 
00508  
00509    suspend_reject=(SUSPEND_REJECT_t*)((msg->data+HEADER_LEN)); 
00510 
00511 #if DEBUG 
00512    printf("Building SUSPEND_REJECT Msg\n"); 
00513 #endif
00514    return msg; 
00515 }

static msg_t* build_timeout ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 1114 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

01115 {
01116    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01117    STATUS_t *status;
01118    msg_t *msg =(msg_t*)create_l3msg(CC_STATUS | REQUEST, MT_STATUS,  bc?bc->l3_id:-1, sizeof(STATUS_t) ,nt); 
01119  
01120    status=(STATUS_t*)((msg->data+HEADER_LEN)); 
01121 
01122 #if DEBUG 
01123    printf("Building STATUS Msg\n"); 
01124 #endif
01125    return msg; 
01126 }

static msg_t* build_user_information ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 480 of file isdn_msg_parser.c.

References misdn_stack::bc, create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, and mISDNUSER_HEAD_SIZE.

00481 {
00482    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00483    USER_INFORMATION_t *user_information;
00484    msg_t *msg =(msg_t*)create_l3msg(CC_USER_INFORMATION | REQUEST, MT_USER_INFORMATION,  bc?bc->l3_id:-1, sizeof(USER_INFORMATION_t) ,nt); 
00485  
00486    user_information=(USER_INFORMATION_t*)((msg->data+HEADER_LEN)); 
00487 
00488 #if DEBUG 
00489    printf("Building USER_INFORMATION Msg\n"); 
00490 #endif
00491    return msg; 
00492 }

char* isdn_get_info ( struct isdn_msg  msgs[],
enum event_e  event,
int  nt 
)

Definition at line 1291 of file isdn_msg_parser.c.

References EVENT_BCHAN_ACTIVATED, EVENT_BCHAN_ACTIVATED_INFO, EVENT_BCHAN_DATA, EVENT_BCHAN_DATA_INFO, EVENT_BCHAN_ERROR, EVENT_BCHAN_ERROR_INFO, EVENT_CLEAN_INFO, EVENT_CLEANUP, EVENT_DTMF_TONE, EVENT_DTMF_TONE_INFO, EVENT_NEW_BC, EVENT_NEW_BC_INFO, EVENT_NEW_CHANNEL, EVENT_NEW_CHANNEL_INFO, EVENT_NEW_L3ID, EVENT_NEW_L3ID_INFO, EVENT_PORT_ALARM, EVENT_PORT_ALARM_INFO, EVENT_TONE_GENERATE, EVENT_TONE_GENERATE_INFO, isdn_msg::info, and isdn_msg_get_index_by_event().

Referenced by handle_event_nt(), handle_frm(), handle_l1(), manager_isdn_get_info(), and misdn_lib_send_event().

01292 {
01293    int i=isdn_msg_get_index_by_event(msgs, event, nt);
01294    
01295    if(i>=0) return msgs[i].info;
01296    
01297    if (event == EVENT_CLEANUP) return EVENT_CLEAN_INFO;
01298    if (event == EVENT_DTMF_TONE) return EVENT_DTMF_TONE_INFO;
01299    if (event == EVENT_NEW_L3ID) return EVENT_NEW_L3ID_INFO;
01300    if (event == EVENT_NEW_BC) return EVENT_NEW_BC_INFO;
01301    if (event == EVENT_NEW_CHANNEL) return EVENT_NEW_CHANNEL_INFO;
01302    if (event == EVENT_BCHAN_DATA) return EVENT_BCHAN_DATA_INFO;
01303    if (event == EVENT_BCHAN_ACTIVATED) return EVENT_BCHAN_ACTIVATED_INFO;
01304    if (event == EVENT_TONE_GENERATE) return EVENT_TONE_GENERATE_INFO;
01305    if (event == EVENT_PORT_ALARM) return EVENT_PORT_ALARM_INFO;
01306    if (event == EVENT_BCHAN_ERROR) return EVENT_BCHAN_ERROR_INFO;
01307    
01308    return NULL;
01309 }

msg_t* isdn_msg_build_event ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
enum event_e  event,
int  nt 
)

Definition at line 1320 of file isdn_msg_parser.c.

References isdn_msg_get_index_by_event(), and isdn_msg::msg_builder.

Referenced by misdn_lib_send_event().

01321 {
01322    int i=isdn_msg_get_index_by_event(msgs, event, nt);
01323    if(i<0) return NULL;
01324   
01325    return  msgs[i].msg_builder(msgs, bc, nt);
01326 }

enum event_e isdn_msg_get_event ( struct isdn_msg  msgs[],
msg_t *  msg,
int  nt 
)

Definition at line 1265 of file isdn_msg_parser.c.

References isdn_msg::event, EVENT_UNKNOWN, and isdn_msg_get_index().

Referenced by handle_event_nt(), and handle_frm().

01266 {
01267    int i=isdn_msg_get_index(msgs, msg, nt);
01268    if(i>=0) return msgs[i].event;
01269    return EVENT_UNKNOWN;
01270 }

int isdn_msg_get_index ( struct isdn_msg  msgs[],
msg_t *  msg,
int  nt 
)

INTERFACE FCTS

Definition at line 1233 of file isdn_msg_parser.c.

References isdn_msg::misdn_msg, and msgs_max.

Referenced by isdn_msg_get_event(), isdn_msg_get_info(), and isdn_msg_parse_event().

01234 {
01235    int i;
01236 
01237    if (nt){
01238       mISDNuser_head_t *hh = (mISDNuser_head_t*)msg->data;
01239       
01240       for (i=0; i< msgs_max -1; i++) {
01241          if ( (hh->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
01242       }
01243       
01244    } else {
01245       iframe_t *frm = (iframe_t*)msg->data;
01246     
01247       for (i=0; i< msgs_max -1; i++) 
01248          if ( (frm->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
01249    }
01250 
01251    return -1;
01252 }

int isdn_msg_get_index_by_event ( struct isdn_msg  msgs[],
enum event_e  event,
int  nt 
)

Definition at line 1254 of file isdn_msg_parser.c.

References cb_log, and msgs_max.

Referenced by isdn_get_info(), and isdn_msg_build_event().

01255 {
01256    int i;
01257    for (i=0; i< msgs_max; i++) 
01258       if ( event == msgs[i].event) return i;
01259 
01260    cb_log(10,0, "get_index: event not found!\n");
01261    
01262    return -1;
01263 }

char* isdn_msg_get_info ( struct isdn_msg  msgs[],
msg_t *  msg,
int  nt 
)

Definition at line 1272 of file isdn_msg_parser.c.

References isdn_msg::info, and isdn_msg_get_index().

01273 {
01274    int i=isdn_msg_get_index(msgs, msg, nt);
01275    if(i>=0) return msgs[i].info;
01276    return NULL;
01277 }

int isdn_msg_parse_event ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
)

Definition at line 1311 of file isdn_msg_parser.c.

References isdn_msg_get_index(), and isdn_msg::msg_parser.

Referenced by handle_event_nt(), and handle_frm().

01312 {
01313    int i=isdn_msg_get_index(msgs, msg, nt);
01314    if(i<0) return -1;
01315 
01316    msgs[i].msg_parser(msgs, msg, bc, nt);
01317    return 0;
01318 }

static void parse_alerting ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 92 of file isdn_msg_parser.c.

References misdn_stack::bc, dec_ie_progress(), HEADER_LEN, mISDNUSER_HEAD_SIZE, misdn_bchannel::progress_coding, misdn_bchannel::progress_indicator, and misdn_bchannel::progress_location.

00093 {
00094    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN; 
00095    ALERTING_t *alerting=(ALERTING_t*)((unsigned long)(msg->data+HEADER_LEN));
00096    //Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);
00097    
00098    dec_ie_progress(alerting->PROGRESS, (Q931_info_t *)alerting, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00099    
00100 #if DEBUG 
00101    printf("Parsing ALERTING Msg\n"); 
00102 #endif
00103 
00104  
00105 }

static void parse_connect ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 356 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::cad, misdn_bchannel::ces, misdn_bchannel::cpnnumplan, dec_ie_connected_pn(), dec_ie_progress(), HEADER_LEN, mISDNUSER_HEAD_SIZE, misdn_bchannel::progress_coding, misdn_bchannel::progress_indicator, and misdn_bchannel::progress_location.

00357 {
00358    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00359    CONNECT_t *connect=(CONNECT_t*)((unsigned long)(msg->data+HEADER_LEN));
00360   
00361    int plan,pres,screen;
00362    
00363    bc->ces = connect->ces;
00364    bc->ces = connect->ces;
00365 
00366    dec_ie_progress(connect->PROGRESS, (Q931_info_t *)connect, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00367 
00368    dec_ie_connected_pn(connect->CONNECT_PN,(Q931_info_t *)connect, &bc->cpnnumplan, &plan, &pres, &screen, bc->cad, 31, nt, bc);
00369 
00370    /*
00371       cb_log(1,bc->port,"CONNETED PN: %s cpn_dialplan:%d\n", connected_pn, type);
00372    */
00373    
00374 #if DEBUG 
00375    printf("Parsing CONNECT Msg\n"); 
00376 #endif
00377 }

static void parse_connect_acknowledge ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 446 of file isdn_msg_parser.c.

00447 {
00448 #if DEBUG 
00449    printf("Parsing CONNECT_ACKNOWLEDGE Msg\n"); 
00450 #endif
00451 
00452  
00453 }

static void parse_disconnect ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 771 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::cause, dec_ie_cause(), dec_ie_progress(), HEADER_LEN, mISDNUSER_HEAD_SIZE, misdn_bchannel::progress_coding, misdn_bchannel::progress_indicator, and misdn_bchannel::progress_location.

00772 {
00773    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00774    DISCONNECT_t *disconnect=(DISCONNECT_t*)((unsigned long)(msg->data+HEADER_LEN));
00775    int location;
00776    int cause; 
00777    dec_ie_cause(disconnect->CAUSE, (Q931_info_t *)(disconnect), &location, &cause, nt,bc);
00778    if (cause>0) bc->cause=cause;
00779 
00780    dec_ie_progress(disconnect->PROGRESS, (Q931_info_t *)disconnect, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00781 #if DEBUG 
00782    printf("Parsing DISCONNECT Msg\n"); 
00783 #endif
00784 
00785  
00786 }

static void parse_facility ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 929 of file isdn_msg_parser.c.

References misdn_stack::bc, cb_log, misdn_bchannel::fac_in, HEADER_LEN, mISDNUSER_HEAD_SIZE, misdn_bchannel::nt, and misdn_bchannel::port.

00930 {
00931    int HEADER_LEN = nt ? mISDNUSER_HEAD_SIZE : mISDN_HEADER_LEN;
00932    FACILITY_t *facility = (FACILITY_t*)(msg->data+HEADER_LEN); 
00933    Q931_info_t *qi = (Q931_info_t*)(msg->data+HEADER_LEN);  
00934    unsigned char *p = NULL;
00935    int err;
00936 
00937 #if DEBUG 
00938    printf("Parsing FACILITY Msg\n"); 
00939 #endif
00940 
00941    if (!bc->nt) {
00942       if (qi->QI_ELEMENT(facility))
00943          p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(facility) + 1;
00944    } else {
00945       p = facility->FACILITY;
00946    }
00947    if (!p)
00948       return;
00949    
00950    err = decodeFac(p, &(bc->fac_in));
00951    if (err) {
00952       cb_log(1, bc->port, "Decoding FACILITY failed! (%d)\n", err);
00953    }
00954 }

static void parse_hold ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 540 of file isdn_msg_parser.c.

00541 {
00542 #if DEBUG 
00543    printf("Parsing HOLD Msg\n"); 
00544 #endif
00545 
00546  
00547 }

static void parse_hold_acknowledge ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 609 of file isdn_msg_parser.c.

00610 {
00611 #if DEBUG 
00612    printf("Parsing HOLD_ACKNOWLEDGE Msg\n"); 
00613 #endif
00614 
00615  
00616 }

static void parse_hold_reject ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 678 of file isdn_msg_parser.c.

00679 {
00680 #if DEBUG 
00681    printf("Parsing HOLD_REJECT Msg\n"); 
00682 #endif
00683 
00684  
00685 }

static void parse_information ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 1034 of file isdn_msg_parser.c.

References misdn_stack::bc, dec_ie_called_pn(), dec_ie_keypad(), HEADER_LEN, misdn_bchannel::info_dad, misdn_bchannel::keypad, mISDNUSER_HEAD_SIZE, and type.

01035 {
01036    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01037    INFORMATION_t *information=(INFORMATION_t*)((unsigned long)(msg->data+HEADER_LEN));
01038    {
01039       int  type, plan;
01040       char number[32];
01041       char keypad[32];
01042       dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *)information, &type, &plan, number, sizeof(number)-1, nt, bc);
01043       dec_ie_keypad(information->KEYPAD, (Q931_info_t *)information, keypad, sizeof(keypad)-1, nt, bc);
01044       strcpy(bc->info_dad, number);
01045       strcpy(bc->keypad,keypad);
01046    }
01047 #if DEBUG 
01048    printf("Parsing INFORMATION Msg\n"); 
01049 #endif
01050 }

static void parse_notify ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 992 of file isdn_msg_parser.c.

00993 {
00994 #if DEBUG 
00995    printf("Parsing NOTIFY Msg\n"); 
00996 #endif
00997 }

static void parse_proceeding ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 51 of file isdn_msg_parser.c.

References misdn_stack::bc, dec_ie_channel_id(), dec_ie_progress(), HEADER_LEN, mISDNUSER_HEAD_SIZE, misdn_bchannel::progress_coding, misdn_bchannel::progress_indicator, misdn_bchannel::progress_location, and set_channel().

00052 {
00053    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00054    CALL_PROCEEDING_t *proceeding=(CALL_PROCEEDING_t*)((unsigned long)msg->data+ HEADER_LEN);
00055    //struct misdn_stack *stack=get_stack_by_bc(bc);
00056    
00057    {
00058       int  exclusive, channel;
00059       dec_ie_channel_id(proceeding->CHANNEL_ID, (Q931_info_t *)proceeding, &exclusive, &channel, nt,bc);
00060 
00061       set_channel(bc,channel);
00062       
00063    }
00064    
00065    dec_ie_progress(proceeding->PROGRESS, (Q931_info_t *)proceeding, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00066    
00067    
00068 #if DEBUG 
00069    printf("Parsing PROCEEDING Msg\n"); 
00070 #endif
00071 }

static void parse_progress ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 126 of file isdn_msg_parser.c.

References misdn_stack::bc, dec_ie_progress(), HEADER_LEN, mISDNUSER_HEAD_SIZE, misdn_bchannel::progress_coding, misdn_bchannel::progress_indicator, and misdn_bchannel::progress_location.

00127 {
00128    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00129    PROGRESS_t *progress=(PROGRESS_t*)((unsigned long)(msg->data+HEADER_LEN)); 
00130    //Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);  
00131    
00132    dec_ie_progress(progress->PROGRESS, (Q931_info_t *)progress, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00133    
00134 #if DEBUG 
00135    printf("Parsing PROGRESS Msg\n"); 
00136 #endif
00137 }

static void parse_release ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 846 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::cause, dec_ie_cause(), HEADER_LEN, and mISDNUSER_HEAD_SIZE.

00847 {
00848    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00849    RELEASE_t *release=(RELEASE_t*)((unsigned long)(msg->data+HEADER_LEN));
00850    int location;
00851    int cause;
00852   
00853    dec_ie_cause(release->CAUSE, (Q931_info_t *)(release), &location, &cause, nt,bc);
00854    if (cause>0) bc->cause=cause;
00855 #if DEBUG 
00856    printf("Parsing RELEASE Msg\n"); 
00857 #endif
00858 
00859  
00860 }

static void parse_release_complete ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 879 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::cause, cb_log, dec_ie_cause(), get_stack_by_bc(), HEADER_LEN, and mISDNUSER_HEAD_SIZE.

00880 {
00881    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00882    RELEASE_COMPLETE_t *release_complete=(RELEASE_COMPLETE_t*)((unsigned long)(msg->data+HEADER_LEN));
00883    int location;
00884    int cause;
00885    iframe_t *frm = (iframe_t*) msg->data;
00886 
00887    struct misdn_stack *stack=get_stack_by_bc(bc);
00888    mISDNuser_head_t *hh;
00889    hh=(mISDNuser_head_t*)msg->data;
00890 
00891    /*hh=(mISDN_head_t*)msg->data;
00892    mISDN_head_t *hh;*/
00893 
00894    if (nt) {
00895       if (hh->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
00896          cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [NT] \n");
00897          return;
00898       }
00899    } else {
00900       if (frm->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
00901          cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [TE] \n");
00902          return;
00903       }
00904    }
00905    dec_ie_cause(release_complete->CAUSE, (Q931_info_t *)(release_complete), &location, &cause, nt,bc);
00906    if (cause>0) bc->cause=cause;
00907 
00908 #if DEBUG 
00909    printf("Parsing RELEASE_COMPLETE Msg\n"); 
00910 #endif
00911 }

static void parse_restart ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 805 of file isdn_msg_parser.c.

References misdn_stack::bc, cb_log, dec_ie_channel_id(), get_stack_by_bc(), HEADER_LEN, mISDNUSER_HEAD_SIZE, misdn_stack::port, and misdn_bchannel::restart_channel.

00806 {
00807    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00808    RESTART_t *restart=(RESTART_t*)((unsigned long)(msg->data+HEADER_LEN));
00809 
00810    struct misdn_stack *stack=get_stack_by_bc(bc);
00811    
00812 #if DEBUG 
00813    printf("Parsing RESTART Msg\n");
00814 #endif
00815   
00816    {
00817       int  exclusive, channel = 0;
00818       dec_ie_channel_id(restart->CHANNEL_ID, (Q931_info_t *)restart, &exclusive, &bc->restart_channel, nt,bc);
00819       /* XXX: this is broken... channel is not used */
00820       if (channel==0xff) /* any channel */
00821          channel=-1;
00822       cb_log(3, stack->port, "CC_RESTART Request on channel:%d on this port.\n");
00823    }
00824   
00825  
00826 }

static void parse_resume ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 586 of file isdn_msg_parser.c.

00587 {
00588 #if DEBUG 
00589    printf("Parsing RESUME Msg\n"); 
00590 #endif
00591 
00592  
00593 }

static void parse_resume_acknowledge ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 655 of file isdn_msg_parser.c.

00656 {
00657 #if DEBUG 
00658    printf("Parsing RESUME_ACKNOWLEDGE Msg\n"); 
00659 #endif
00660 
00661  
00662 }

static void parse_resume_reject ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 517 of file isdn_msg_parser.c.

00518 {
00519 #if DEBUG 
00520    printf("Parsing RESUME_REJECT Msg\n"); 
00521 #endif
00522 
00523  
00524 }

static void parse_retrieve ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 701 of file isdn_msg_parser.c.

00702 {
00703 #if DEBUG 
00704    printf("Parsing RETRIEVE Msg\n"); 
00705 #endif
00706 
00707  
00708 }

static void parse_retrieve_acknowledge ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 724 of file isdn_msg_parser.c.

00725 {
00726 #if DEBUG 
00727    printf("Parsing RETRIEVE_ACKNOWLEDGE Msg\n"); 
00728 #endif
00729 
00730  
00731 }

static void parse_retrieve_reject ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 748 of file isdn_msg_parser.c.

00749 {
00750 #if DEBUG 
00751    printf("Parsing RETRIEVE_REJECT Msg\n"); 
00752 #endif
00753 
00754  
00755 }

static void parse_setup ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 153 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::capability, capability, cb_log, misdn_bchannel::dad, dec_ie_bearer(), dec_ie_called_pn(), dec_ie_calling_pn(), dec_ie_channel_id(), dec_ie_complete(), dec_ie_keypad(), dec_ie_progress(), dec_ie_redir_nr(), dec_ie_useruser(), misdn_bchannel::dnumplan, HEADER_LEN, INFO_CAPABILITY_DIGITAL_RESTRICTED, INFO_CAPABILITY_DIGITAL_UNRESTRICTED, INFO_CAPABILITY_SPEECH, INFO_CAPABILITY_VIDEO, INFO_CODEC_ALAW, INFO_CODEC_ULAW, misdn_bchannel::keypad, misdn_bchannel::law, mISDNUSER_HEAD_SIZE, misdn_bchannel::mode, misdn_bchannel::oad, misdn_bchannel::onumplan, misdn_bchannel::port, misdn_bchannel::pres, misdn_bchannel::progress_coding, misdn_bchannel::progress_indicator, misdn_bchannel::progress_location, misdn_bchannel::rad, misdn_bchannel::rate, misdn_bchannel::rnumplan, misdn_bchannel::sending_complete, set_channel(), type, misdn_bchannel::urate, misdn_bchannel::user1, misdn_bchannel::uu, and misdn_bchannel::uulen.

00154 { 
00155    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00156    SETUP_t *setup= (SETUP_t*)((unsigned long)msg->data+HEADER_LEN);
00157    Q931_info_t *qi=(Q931_info_t*)((unsigned long)msg->data+HEADER_LEN);
00158 
00159 #if DEBUG 
00160    printf("Parsing SETUP Msg\n"); 
00161 #endif
00162    {
00163       int type,plan,present, screen;
00164       char id[32];
00165       dec_ie_calling_pn(setup->CALLING_PN, qi, &type, &plan, &present, &screen, id, sizeof(id)-1, nt,bc);
00166 
00167       bc->onumplan=type; 
00168       strcpy(bc->oad, id);
00169       switch (present) {
00170       case 0:
00171          bc->pres=0; /* screened */
00172          break;
00173       case 1:
00174          bc->pres=1; /* not screened */
00175          break;
00176       default:
00177          bc->pres=0;
00178       }
00179       switch (screen) {
00180       case 0:
00181          break;
00182       default:
00183          ;
00184       } 
00185    }
00186    {
00187       int  type, plan;
00188       char number[32]; 
00189       dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *)setup, &type, &plan, number, sizeof(number)-1, nt,bc);
00190       strcpy(bc->dad, number);
00191       bc->dnumplan=type; 
00192    }
00193    {
00194       char keypad[32];
00195       dec_ie_keypad(setup->KEYPAD, (Q931_info_t *)setup, keypad, sizeof(keypad)-1, nt,bc);
00196       strcpy(bc->keypad, keypad);
00197    }
00198 
00199    {
00200       dec_ie_complete(setup->COMPLETE, (Q931_info_t *)setup, &bc->sending_complete, nt,bc);
00201       
00202    }
00203   
00204    {
00205       int  type, plan, present, screen, reason;
00206       char id[32]; 
00207       dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *)setup, &type, &plan, &present, &screen, &reason, id, sizeof(id)-1, nt,bc);
00208     
00209       strcpy(bc->rad, id);
00210       bc->rnumplan=type; 
00211    }
00212    {
00213       int  coding, capability, mode, rate, multi, user, async, urate, stopbits, dbits, parity;
00214       dec_ie_bearer(setup->BEARER, (Q931_info_t *)setup, &coding, &capability, &mode, &rate, &multi, &user, &async, &urate, &stopbits, &dbits, &parity, nt,bc);
00215       switch (capability) {
00216       case -1: bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED; 
00217          break;
00218       case 0: bc->capability=INFO_CAPABILITY_SPEECH;
00219          break;
00220       case 18: bc->capability=INFO_CAPABILITY_VIDEO;
00221          break;
00222       case 8: bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
00223          bc->user1 = user;
00224          bc->urate = urate;
00225          
00226          bc->rate = rate;
00227          bc->mode = mode;
00228          break;
00229       case 9: bc->capability=INFO_CAPABILITY_DIGITAL_RESTRICTED;
00230          break;
00231       default:
00232          break;
00233       }
00234       
00235       switch(user) {
00236       case 2:
00237          bc->law=INFO_CODEC_ULAW;
00238          break;
00239       case 3:
00240          bc->law=INFO_CODEC_ALAW;
00241          break;
00242       default:
00243          bc->law=INFO_CODEC_ALAW;
00244          
00245       }
00246       
00247       bc->capability=capability; 
00248    }
00249    {
00250       int  exclusive, channel;
00251       dec_ie_channel_id(setup->CHANNEL_ID, (Q931_info_t *)setup, &exclusive, &channel, nt,bc);
00252       
00253       set_channel(bc,channel);
00254    }
00255 
00256    {
00257       int  protocol ;
00258       dec_ie_useruser(setup->USER_USER, (Q931_info_t *)setup, &protocol, bc->uu, &bc->uulen, nt,bc);
00259       if (bc->uulen) cb_log(1,bc->port,"USERUESRINFO:%s\n",bc->uu);
00260       else
00261       cb_log(1,bc->port,"NO USERUESRINFO\n");
00262    }
00263    
00264    dec_ie_progress(setup->PROGRESS, (Q931_info_t *)setup, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00265    
00266 }

static void parse_setup_acknowledge ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 406 of file isdn_msg_parser.c.

References misdn_stack::bc, dec_ie_channel_id(), dec_ie_progress(), HEADER_LEN, mISDNUSER_HEAD_SIZE, misdn_bchannel::progress_coding, misdn_bchannel::progress_indicator, misdn_bchannel::progress_location, and set_channel().

00407 {
00408    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00409    SETUP_ACKNOWLEDGE_t *setup_acknowledge=(SETUP_ACKNOWLEDGE_t*)((unsigned long)(msg->data+HEADER_LEN));
00410 
00411    {
00412       int  exclusive, channel;
00413       dec_ie_channel_id(setup_acknowledge->CHANNEL_ID, (Q931_info_t *)setup_acknowledge, &exclusive, &channel, nt,bc);
00414 
00415 
00416       set_channel(bc, channel);
00417    }
00418    
00419    dec_ie_progress(setup_acknowledge->PROGRESS, (Q931_info_t *)setup_acknowledge, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00420 #if DEBUG 
00421    printf("Parsing SETUP_ACKNOWLEDGE Msg\n"); 
00422 #endif
00423 
00424  
00425 }

static void parse_status ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 1077 of file isdn_msg_parser.c.

References misdn_stack::bc, misdn_bchannel::cause, dec_ie_cause(), HEADER_LEN, and mISDNUSER_HEAD_SIZE.

01078 {
01079    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01080    STATUS_t *status=(STATUS_t*)((unsigned long)(msg->data+HEADER_LEN));
01081    int location;
01082    int cause;
01083   
01084    dec_ie_cause(status->CAUSE, (Q931_info_t *)(status), &location, &cause, nt,bc);
01085    if (cause>0) bc->cause=cause;
01086    ;
01087 
01088 #if DEBUG 
01089    printf("Parsing STATUS Msg\n"); 
01090 #endif
01091 }

static void parse_status_enquiry ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 1013 of file isdn_msg_parser.c.

01014 {
01015 #if DEBUG 
01016    printf("Parsing STATUS_ENQUIRY Msg\n"); 
01017 #endif
01018 }

static void parse_suspend ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 563 of file isdn_msg_parser.c.

00564 {
00565 #if DEBUG 
00566    printf("Parsing SUSPEND Msg\n"); 
00567 #endif
00568 
00569  
00570 }

static void parse_suspend_acknowledge ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 632 of file isdn_msg_parser.c.

00633 {
00634 #if DEBUG 
00635    printf("Parsing SUSPEND_ACKNOWLEDGE Msg\n"); 
00636 #endif
00637 
00638  
00639 }

static void parse_suspend_reject ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 494 of file isdn_msg_parser.c.

00495 {
00496 #if DEBUG 
00497    printf("Parsing SUSPEND_REJECT Msg\n"); 
00498 #endif
00499 
00500  
00501 }

static void parse_timeout ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 1107 of file isdn_msg_parser.c.

01108 {
01109 #if DEBUG 
01110    printf("Parsing STATUS Msg\n"); 
01111 #endif 
01112 }

static void parse_user_information ( struct isdn_msg  msgs[],
msg_t *  msg,
struct misdn_bchannel bc,
int  nt 
) [static]

Definition at line 471 of file isdn_msg_parser.c.

00472 {
00473 #if DEBUG 
00474    printf("Parsing USER_INFORMATION Msg\n"); 
00475 #endif
00476 
00477  
00478 }

static void set_channel ( struct misdn_bchannel bc,
int  channel 
) [static]

Definition at line 23 of file isdn_msg_parser.c.

References misdn_stack::bc, cb_event, cb_log, misdn_bchannel::channel, EVENT_NEW_CHANNEL, misdn_bchannel::nt, and misdn_bchannel::port.

Referenced by parse_proceeding(), parse_setup(), and parse_setup_acknowledge().

00024 {
00025 
00026    cb_log(3,bc->port,"set_channel: bc->channel:%d channel:%d\n", bc->channel, channel);
00027    
00028    
00029    if (channel==0xff) {
00030       /* any channel */
00031       channel=-1;
00032    }
00033    
00034    /*  ALERT: is that everytime true ?  */
00035    if (channel > 0 && bc->nt ) {
00036       
00037       if (bc->channel && ( bc->channel != 0xff) ) {
00038          cb_log(0,bc->port,"We already have a channel (%d)\n", bc->channel);
00039       } else {
00040          bc->channel = channel;
00041          cb_event(EVENT_NEW_CHANNEL,bc,NULL);
00042       }
00043    }
00044    
00045    if (channel > 0 && !bc->nt ) {
00046       bc->channel = channel;
00047       cb_event(EVENT_NEW_CHANNEL,bc,NULL);
00048    }
00049 }


Variable Documentation

char EVENT_BCHAN_ACTIVATED_INFO[] = "BCHAN_ACTIVATED"

Definition at line 1287 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_BCHAN_DATA_INFO[] = "BCHAN_DATA"

Definition at line 1286 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_BCHAN_ERROR_INFO[] = "BCHAN_ERROR"

Definition at line 1289 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_CLEAN_INFO[] = "CLEAN_UP"

Definition at line 1280 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_DTMF_TONE_INFO[] = "DTMF_TONE"

Definition at line 1281 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_NEW_BC_INFO[] = "NEW_BC"

Definition at line 1283 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_NEW_CHANNEL_INFO[] = "NEW_CHANNEL"

Definition at line 1285 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_NEW_L3ID_INFO[] = "NEW_L3ID"

Definition at line 1282 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_PORT_ALARM_INFO[] = "ALARM"

Definition at line 1284 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_TONE_GENERATE_INFO[] = "TONE_GENERATE"

Definition at line 1288 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

struct isdn_msg msgs_g[]

Msg Array

Definition at line 1136 of file isdn_msg_parser.c.

Referenced by handle_event_nt(), handle_frm(), handle_l1(), manager_isdn_get_info(), and misdn_lib_send_event().


Generated on Mon Apr 30 07:43:53 2007 for Asterisk - the Open Source PBX by  doxygen 1.5.1