Wed Oct 28 11:52:46 2009

Asterisk developer's documentation


isdn_msg_parser.c File Reference

Interface to mISDN - message parser. More...

#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"
struct isdn_msg msgs_g []


Detailed Description

Interface to mISDN - message parser.

Author:
Christian Richter <crich@beronet.com>

Definition in file isdn_msg_parser.c.


Define Documentation

#define ANY_CHANNEL   0xff

Definition at line 274 of file isdn_msg_parser.c.

Referenced by build_setup().

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

Definition at line 1257 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 113 of file isdn_msg_parser.c.

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

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

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

Definition at line 387 of file isdn_msg_parser.c.

References 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, msg, misdn_bchannel::port, and type.

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

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

Definition at line 463 of file isdn_msg_parser.c.

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

00464 {
00465    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00466    CONNECT_ACKNOWLEDGE_t *connect_acknowledge;
00467    msg_t *msg =(msg_t*)create_l3msg(CC_CONNECT | RESPONSE, MT_CONNECT,  bc?bc->l3_id:-1, sizeof(CONNECT_ACKNOWLEDGE_t) ,nt); 
00468  
00469    connect_acknowledge=(CONNECT_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00470   
00471    enc_ie_channel_id(&connect_acknowledge->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
00472   
00473 #ifdef DEBUG 
00474    printf("Building CONNECT_ACKNOWLEDGE Msg\n"); 
00475 #endif
00476    return msg; 
00477 }

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

Definition at line 796 of file isdn_msg_parser.c.

References cb_log, create_l3msg(), enc_ie_cause(), enc_ie_progress(), enc_ie_useruser(), HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, msg, misdn_bchannel::out_cause, misdn_bchannel::port, misdn_bchannel::uu, and misdn_bchannel::uulen.

00797 {
00798    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00799    DISCONNECT_t *disconnect;
00800    msg_t *msg =(msg_t*)create_l3msg(CC_DISCONNECT | REQUEST, MT_DISCONNECT,  bc?bc->l3_id:-1, sizeof(DISCONNECT_t) ,nt); 
00801    
00802    disconnect=(DISCONNECT_t*)((msg->data+HEADER_LEN)); 
00803    
00804    enc_ie_cause(&disconnect->CAUSE, msg, (nt)?1:0, bc->out_cause,nt,bc);
00805    if (nt) enc_ie_progress(&disconnect->PROGRESS, msg, 0, nt?1:5, 8 ,nt,bc);
00806 
00807    if (bc->uulen) {
00808       int  protocol=4;
00809       enc_ie_useruser(&disconnect->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
00810       cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
00811    }
00812   
00813 #ifdef DEBUG 
00814    printf("Building DISCONNECT Msg\n"); 
00815 #endif
00816    return msg; 
00817 }

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

Definition at line 983 of file isdn_msg_parser.c.

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

00984 {
00985    int len,
00986       HEADER_LEN = nt ? mISDNUSER_HEAD_SIZE : mISDN_HEADER_LEN;
00987    unsigned char *ie_fac,
00988               fac_tmp[256];
00989    msg_t *msg =(msg_t*)create_l3msg(CC_FACILITY | REQUEST, MT_FACILITY,  bc?bc->l3_id:-1, sizeof(FACILITY_t) ,nt);
00990    FACILITY_t *facility = (FACILITY_t*)(msg->data+HEADER_LEN); 
00991    Q931_info_t *qi;
00992 
00993 #ifdef DEBUG 
00994    printf("Building FACILITY Msg\n"); 
00995 #endif
00996    
00997    len = encodeFac(fac_tmp, &(bc->fac_out));
00998    if (len <= 0)
00999       return NULL;
01000 
01001    ie_fac = msg_put(msg, len);
01002    if (bc->nt) {
01003       facility->FACILITY = ie_fac + 1;
01004    } else {
01005       qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
01006       qi->QI_ELEMENT(facility) = ie_fac - (unsigned char *)qi - sizeof(Q931_info_t);
01007    }
01008 
01009    memcpy(ie_fac, fac_tmp, len);
01010 
01011    if (*bc->display) {
01012       printf("Sending %s as Display\n", bc->display);
01013       enc_ie_display(&facility->DISPLAY, msg, bc->display, nt,bc);
01014    }
01015 
01016    return msg; 
01017 }

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

Definition at line 557 of file isdn_msg_parser.c.

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

00558 {
00559    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00560    HOLD_t *hold;
00561    msg_t *msg =(msg_t*)create_l3msg(CC_HOLD | REQUEST, MT_HOLD,  bc?bc->l3_id:-1, sizeof(HOLD_t) ,nt); 
00562  
00563    hold=(HOLD_t*)((msg->data+HEADER_LEN)); 
00564 
00565 #ifdef DEBUG 
00566    printf("Building HOLD Msg\n"); 
00567 #endif
00568    return msg; 
00569 }

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

Definition at line 626 of file isdn_msg_parser.c.

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

00627 {
00628    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00629    HOLD_ACKNOWLEDGE_t *hold_acknowledge;
00630    msg_t *msg =(msg_t*)create_l3msg(CC_HOLD_ACKNOWLEDGE | REQUEST, MT_HOLD_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(HOLD_ACKNOWLEDGE_t) ,nt); 
00631  
00632    hold_acknowledge=(HOLD_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00633 
00634 #ifdef DEBUG 
00635    printf("Building HOLD_ACKNOWLEDGE Msg\n"); 
00636 #endif
00637    return msg; 
00638 }

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

Definition at line 695 of file isdn_msg_parser.c.

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

00696 {
00697    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00698    HOLD_REJECT_t *hold_reject;
00699    msg_t *msg =(msg_t*)create_l3msg(CC_HOLD_REJECT | REQUEST, MT_HOLD_REJECT,  bc?bc->l3_id:-1, sizeof(HOLD_REJECT_t) ,nt); 
00700  
00701    hold_reject=(HOLD_REJECT_t*)((msg->data+HEADER_LEN)); 
00702 
00703 #ifdef DEBUG 
00704    printf("Building HOLD_REJECT Msg\n"); 
00705 #endif
00706    return msg; 
00707 }

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

Definition at line 1079 of file isdn_msg_parser.c.

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

01080 {
01081    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01082    INFORMATION_t *information;
01083    msg_t *msg =(msg_t*)create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION,  bc?bc->l3_id:-1, sizeof(INFORMATION_t) ,nt); 
01084  
01085    information=(INFORMATION_t*)((msg->data+HEADER_LEN)); 
01086   
01087    {
01088       enc_ie_called_pn(&information->CALLED_PN, msg, 0, 1, bc->info_dad, nt,bc);
01089    }
01090 
01091    {
01092       if (*bc->display) {
01093          printf("Sending %s as Display\n", bc->display);
01094          enc_ie_display(&information->DISPLAY, msg, bc->display, nt,bc);
01095       }
01096    }
01097   
01098 #ifdef DEBUG 
01099    printf("Building INFORMATION Msg\n"); 
01100 #endif
01101    return msg; 
01102 }

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

Definition at line 1026 of file isdn_msg_parser.c.

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

01027 {
01028    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01029    NOTIFY_t *notify;
01030    msg_t *msg =(msg_t*)create_l3msg(CC_NOTIFY | REQUEST, MT_NOTIFY,  bc?bc->l3_id:-1, sizeof(NOTIFY_t) ,nt); 
01031  
01032    notify=(NOTIFY_t*)((msg->data+HEADER_LEN)); 
01033 
01034 #ifdef DEBUG 
01035    printf("Building NOTIFY Msg\n"); 
01036 #endif
01037    return msg; 
01038 }

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

Definition at line 78 of file isdn_msg_parser.c.

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

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

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

Definition at line 145 of file isdn_msg_parser.c.

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

00146 {
00147    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00148    PROGRESS_t *progress;
00149    msg_t *msg =(msg_t*)create_l3msg(CC_PROGRESS | REQUEST, MT_PROGRESS,  bc?bc->l3_id:-1, sizeof(PROGRESS_t) ,nt); 
00150  
00151    progress=(PROGRESS_t*)((msg->data+HEADER_LEN)); 
00152 
00153 #ifdef DEBUG 
00154    printf("Building PROGRESS Msg\n"); 
00155 #endif
00156    return msg; 
00157 }

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

Definition at line 877 of file isdn_msg_parser.c.

References cb_log, create_l3msg(), enc_ie_cause(), enc_ie_useruser(), HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, msg, misdn_bchannel::out_cause, misdn_bchannel::port, misdn_bchannel::uu, and misdn_bchannel::uulen.

00878 {
00879    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00880    RELEASE_t *release;
00881    msg_t *msg =(msg_t*)create_l3msg(CC_RELEASE | REQUEST, MT_RELEASE,  bc?bc->l3_id:-1, sizeof(RELEASE_t) ,nt); 
00882  
00883    release=(RELEASE_t*)((msg->data+HEADER_LEN)); 
00884   
00885    if (bc->out_cause>= 0)
00886       enc_ie_cause(&release->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
00887 
00888    if (bc->uulen) {
00889       int  protocol=4;
00890       enc_ie_useruser(&release->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
00891       cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
00892    }
00893   
00894 #ifdef DEBUG 
00895    printf("Building RELEASE Msg\n"); 
00896 #endif
00897    return msg; 
00898 }

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

Definition at line 934 of file isdn_msg_parser.c.

References cb_log, create_l3msg(), enc_ie_cause(), enc_ie_useruser(), HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, msg, misdn_bchannel::out_cause, misdn_bchannel::port, misdn_bchannel::uu, and misdn_bchannel::uulen.

00935 {
00936    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00937    RELEASE_COMPLETE_t *release_complete;
00938    msg_t *msg =(msg_t*)create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE,  bc?bc->l3_id:-1, sizeof(RELEASE_COMPLETE_t) ,nt); 
00939  
00940    release_complete=(RELEASE_COMPLETE_t*)((msg->data+HEADER_LEN)); 
00941    
00942    enc_ie_cause(&release_complete->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
00943 
00944    if (bc->uulen) {
00945       int  protocol=4;
00946       enc_ie_useruser(&release_complete->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
00947       cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
00948    }
00949   
00950 #ifdef DEBUG 
00951    printf("Building RELEASE_COMPLETE Msg\n"); 
00952 #endif
00953    return msg; 
00954 }

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

Definition at line 838 of file isdn_msg_parser.c.

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

00839 {
00840    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00841    RESTART_t *restart;
00842    msg_t *msg =(msg_t*)create_l3msg(CC_RESTART | REQUEST, MT_RESTART,  bc?bc->l3_id:-1, sizeof(RESTART_t) ,nt); 
00843  
00844    restart=(RESTART_t*)((msg->data+HEADER_LEN)); 
00845 
00846 #ifdef DEBUG 
00847    printf("Building RESTART Msg\n"); 
00848 #endif
00849 
00850    if (bc->channel > 0) {
00851       enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
00852       enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x80, nt, bc);
00853    } else {
00854       enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x87, nt, bc);
00855    }
00856 
00857    cb_log(0,bc->port, "Restarting channel %d\n", bc->channel);
00858    return msg; 
00859 }

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

Definition at line 603 of file isdn_msg_parser.c.

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

00604 {
00605    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00606    RESUME_t *resume;
00607    msg_t *msg =(msg_t*)create_l3msg(CC_RESUME | REQUEST, MT_RESUME,  bc?bc->l3_id:-1, sizeof(RESUME_t) ,nt); 
00608  
00609    resume=(RESUME_t*)((msg->data+HEADER_LEN)); 
00610 
00611 #ifdef DEBUG 
00612    printf("Building RESUME Msg\n"); 
00613 #endif
00614    return msg; 
00615 }

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

Definition at line 672 of file isdn_msg_parser.c.

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

00673 {
00674    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00675    RESUME_ACKNOWLEDGE_t *resume_acknowledge;
00676    msg_t *msg =(msg_t*)create_l3msg(CC_RESUME_ACKNOWLEDGE | REQUEST, MT_RESUME_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(RESUME_ACKNOWLEDGE_t) ,nt); 
00677  
00678    resume_acknowledge=(RESUME_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00679 
00680 #ifdef DEBUG 
00681    printf("Building RESUME_ACKNOWLEDGE Msg\n"); 
00682 #endif
00683    return msg; 
00684 }

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

Definition at line 534 of file isdn_msg_parser.c.

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

00535 {
00536    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00537    RESUME_REJECT_t *resume_reject;
00538    msg_t *msg =(msg_t*)create_l3msg(CC_RESUME_REJECT | REQUEST, MT_RESUME_REJECT,  bc?bc->l3_id:-1, sizeof(RESUME_REJECT_t) ,nt); 
00539  
00540    resume_reject=(RESUME_REJECT_t*)((msg->data+HEADER_LEN)); 
00541 
00542 #ifdef DEBUG 
00543    printf("Building RESUME_REJECT Msg\n"); 
00544 #endif
00545    return msg; 
00546 }

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

Definition at line 718 of file isdn_msg_parser.c.

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

00719 {
00720    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00721    RETRIEVE_t *retrieve;
00722    msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE | REQUEST, MT_RETRIEVE,  bc?bc->l3_id:-1, sizeof(RETRIEVE_t) ,nt); 
00723  
00724    retrieve=(RETRIEVE_t*)((msg->data+HEADER_LEN)); 
00725 
00726 #ifdef DEBUG 
00727    printf("Building RETRIEVE Msg\n"); 
00728 #endif
00729    return msg; 
00730 }

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

Definition at line 741 of file isdn_msg_parser.c.

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

00742 {
00743    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00744    RETRIEVE_ACKNOWLEDGE_t *retrieve_acknowledge;
00745    msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE_ACKNOWLEDGE | REQUEST, MT_RETRIEVE_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(RETRIEVE_ACKNOWLEDGE_t) ,nt); 
00746  
00747    retrieve_acknowledge=(RETRIEVE_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00748 
00749    enc_ie_channel_id(&retrieve_acknowledge->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
00750 #ifdef DEBUG 
00751    printf("Building RETRIEVE_ACKNOWLEDGE Msg\n"); 
00752 #endif
00753    return msg; 
00754 }

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

Definition at line 765 of file isdn_msg_parser.c.

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

00766 {
00767    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00768    RETRIEVE_REJECT_t *retrieve_reject;
00769    msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE_REJECT | REQUEST, MT_RETRIEVE_REJECT,  bc?bc->l3_id:-1, sizeof(RETRIEVE_REJECT_t) ,nt); 
00770  
00771    retrieve_reject=(RETRIEVE_REJECT_t*)((msg->data+HEADER_LEN)); 
00772 
00773 #ifdef DEBUG 
00774    printf("Building RETRIEVE_REJECT Msg\n"); 
00775 #endif
00776    return msg; 
00777 }

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

Definition at line 275 of file isdn_msg_parser.c.

References ANY_CHANNEL, 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_keypad(), 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::keypad, misdn_bchannel::l3_id, misdn_bchannel::law, mISDNUSER_HEAD_SIZE, misdn_bchannel::mode, msg, 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.

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

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

Definition at line 435 of file isdn_msg_parser.c.

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

00436 {
00437    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00438    SETUP_ACKNOWLEDGE_t *setup_acknowledge;
00439    msg_t *msg =(msg_t*)create_l3msg(CC_SETUP_ACKNOWLEDGE | REQUEST, MT_SETUP_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(SETUP_ACKNOWLEDGE_t) ,nt); 
00440  
00441    setup_acknowledge=(SETUP_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00442   
00443    enc_ie_channel_id(&setup_acknowledge->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
00444   
00445    if (nt) 
00446       enc_ie_progress(&setup_acknowledge->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
00447   
00448 #ifdef DEBUG 
00449    printf("Building SETUP_ACKNOWLEDGE Msg\n"); 
00450 #endif
00451    return msg; 
00452 }

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

Definition at line 1120 of file isdn_msg_parser.c.

References create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, msg, and status.

01121 {
01122    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01123    STATUS_t *status;
01124    msg_t *msg =(msg_t*)create_l3msg(CC_STATUS | REQUEST, MT_STATUS,  bc?bc->l3_id:-1, sizeof(STATUS_t) ,nt); 
01125  
01126    status=(STATUS_t*)((msg->data+HEADER_LEN)); 
01127 
01128 #ifdef DEBUG 
01129    printf("Building STATUS Msg\n"); 
01130 #endif
01131    return msg; 
01132 }

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

Definition at line 1047 of file isdn_msg_parser.c.

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

01048 {
01049    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01050    STATUS_ENQUIRY_t *status_enquiry;
01051    msg_t *msg =(msg_t*)create_l3msg(CC_STATUS_ENQUIRY | REQUEST, MT_STATUS_ENQUIRY,  bc?bc->l3_id:-1, sizeof(STATUS_ENQUIRY_t) ,nt); 
01052  
01053    status_enquiry=(STATUS_ENQUIRY_t*)((msg->data+HEADER_LEN)); 
01054 
01055 #ifdef DEBUG 
01056    printf("Building STATUS_ENQUIRY Msg\n"); 
01057 #endif
01058    return msg; 
01059 }

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

Definition at line 580 of file isdn_msg_parser.c.

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

00581 {
00582    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00583    SUSPEND_t *suspend;
00584    msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND | REQUEST, MT_SUSPEND,  bc?bc->l3_id:-1, sizeof(SUSPEND_t) ,nt); 
00585  
00586    suspend=(SUSPEND_t*)((msg->data+HEADER_LEN)); 
00587 
00588 #ifdef DEBUG 
00589    printf("Building SUSPEND Msg\n"); 
00590 #endif
00591    return msg; 
00592 }

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

Definition at line 649 of file isdn_msg_parser.c.

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

00650 {
00651    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00652    SUSPEND_ACKNOWLEDGE_t *suspend_acknowledge;
00653    msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND_ACKNOWLEDGE | REQUEST, MT_SUSPEND_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(SUSPEND_ACKNOWLEDGE_t) ,nt); 
00654  
00655    suspend_acknowledge=(SUSPEND_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN)); 
00656 
00657 #ifdef DEBUG 
00658    printf("Building SUSPEND_ACKNOWLEDGE Msg\n"); 
00659 #endif
00660    return msg; 
00661 }

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

Definition at line 511 of file isdn_msg_parser.c.

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

00512 {
00513    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00514    SUSPEND_REJECT_t *suspend_reject;
00515    msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND_REJECT | REQUEST, MT_SUSPEND_REJECT,  bc?bc->l3_id:-1, sizeof(SUSPEND_REJECT_t) ,nt); 
00516  
00517    suspend_reject=(SUSPEND_REJECT_t*)((msg->data+HEADER_LEN)); 
00518 
00519 #ifdef DEBUG 
00520    printf("Building SUSPEND_REJECT Msg\n"); 
00521 #endif
00522    return msg; 
00523 }

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

Definition at line 1141 of file isdn_msg_parser.c.

References create_l3msg(), HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, msg, and status.

01142 {
01143    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01144    STATUS_t *status;
01145    msg_t *msg =(msg_t*)create_l3msg(CC_STATUS | REQUEST, MT_STATUS,  bc?bc->l3_id:-1, sizeof(STATUS_t) ,nt); 
01146  
01147    status=(STATUS_t*)((msg->data+HEADER_LEN)); 
01148 
01149 #ifdef DEBUG 
01150    printf("Building STATUS Msg\n"); 
01151 #endif
01152    return msg; 
01153 }

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

Definition at line 488 of file isdn_msg_parser.c.

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

00489 {
00490    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00491    USER_INFORMATION_t *user_information;
00492    msg_t *msg =(msg_t*)create_l3msg(CC_USER_INFORMATION | REQUEST, MT_USER_INFORMATION,  bc?bc->l3_id:-1, sizeof(USER_INFORMATION_t) ,nt); 
00493  
00494    user_information=(USER_INFORMATION_t*)((msg->data+HEADER_LEN)); 
00495 
00496 #ifdef DEBUG 
00497    printf("Building USER_INFORMATION Msg\n"); 
00498 #endif
00499    return msg; 
00500 }

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 
)

Definition at line 1347 of file isdn_msg_parser.c.

References isdn_msg_get_index_by_event(), and isdn_msg::msg_builder.

Referenced by misdn_lib_send_event().

01348 {
01349    int i=isdn_msg_get_index_by_event(msgs, event, nt);
01350    if(i<0) return NULL;
01351   
01352    return  msgs[i].msg_builder(msgs, bc, nt);
01353 }

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

Definition at line 1292 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().

01293 {
01294    int i=isdn_msg_get_index(msgs, msg, nt);
01295    if(i>=0) return msgs[i].event;
01296    return EVENT_UNKNOWN;
01297 }

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

INTERFACE FCTS

Definition at line 1260 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().

01261 {
01262    int i;
01263 
01264    if (nt){
01265       mISDNuser_head_t *hh = (mISDNuser_head_t*)msg->data;
01266       
01267       for (i=0; i< msgs_max -1; i++) {
01268          if ( (hh->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
01269       }
01270       
01271    } else {
01272       iframe_t *frm = (iframe_t*)msg->data;
01273     
01274       for (i=0; i< msgs_max -1; i++) 
01275          if ( (frm->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
01276    }
01277 
01278    return -1;
01279 }

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

Definition at line 1281 of file isdn_msg_parser.c.

References cb_log, and msgs_max.

Referenced by isdn_get_info(), and isdn_msg_build_event().

01282 {
01283    int i;
01284    for (i=0; i< msgs_max; i++) 
01285       if ( event == msgs[i].event) return i;
01286 
01287    cb_log(10,0, "get_index: event not found!\n");
01288    
01289    return -1;
01290 }

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

Definition at line 1299 of file isdn_msg_parser.c.

References isdn_msg::info, and isdn_msg_get_index().

01300 {
01301    int i=isdn_msg_get_index(msgs, msg, nt);
01302    if(i>=0) return msgs[i].info;
01303    return NULL;
01304 }

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

Definition at line 1338 of file isdn_msg_parser.c.

References isdn_msg_get_index(), and isdn_msg::msg_parser.

Referenced by handle_event_nt(), and handle_frm().

01339 {
01340    int i=isdn_msg_get_index(msgs, msg, nt);
01341    if(i<0) return -1;
01342 
01343    msgs[i].msg_parser(msgs, msg, bc, nt);
01344    return 0;
01345 }

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

Definition at line 98 of file isdn_msg_parser.c.

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

00099 {
00100    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN; 
00101    ALERTING_t *alerting=(ALERTING_t*)((unsigned long)(msg->data+HEADER_LEN));
00102    //Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);
00103    
00104    dec_ie_progress(alerting->PROGRESS, (Q931_info_t *)alerting, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00105    
00106 #ifdef DEBUG 
00107    printf("Parsing ALERTING Msg\n"); 
00108 #endif
00109 
00110  
00111 }

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

Definition at line 364 of file isdn_msg_parser.c.

References 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.

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

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

Definition at line 454 of file isdn_msg_parser.c.

00455 {
00456 #ifdef DEBUG 
00457    printf("Parsing CONNECT_ACKNOWLEDGE Msg\n"); 
00458 #endif
00459 
00460  
00461 }

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

Definition at line 779 of file isdn_msg_parser.c.

References 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.

00780 {
00781    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00782    DISCONNECT_t *disconnect=(DISCONNECT_t*)((unsigned long)(msg->data+HEADER_LEN));
00783    int location;
00784    int cause; 
00785    dec_ie_cause(disconnect->CAUSE, (Q931_info_t *)(disconnect), &location, &cause, nt,bc);
00786    if (cause>0) bc->cause=cause;
00787 
00788    dec_ie_progress(disconnect->PROGRESS, (Q931_info_t *)disconnect, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00789 #ifdef DEBUG 
00790    printf("Parsing DISCONNECT Msg\n"); 
00791 #endif
00792 
00793  
00794 }

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

Definition at line 956 of file isdn_msg_parser.c.

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

00957 {
00958    int HEADER_LEN = nt ? mISDNUSER_HEAD_SIZE : mISDN_HEADER_LEN;
00959    FACILITY_t *facility = (FACILITY_t*)(msg->data+HEADER_LEN); 
00960    Q931_info_t *qi = (Q931_info_t*)(msg->data+HEADER_LEN);  
00961    unsigned char *p = NULL;
00962    int err;
00963 
00964 #ifdef DEBUG 
00965    printf("Parsing FACILITY Msg\n"); 
00966 #endif
00967 
00968    if (!bc->nt) {
00969       if (qi->QI_ELEMENT(facility))
00970          p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(facility) + 1;
00971    } else {
00972       p = facility->FACILITY;
00973    }
00974    if (!p)
00975       return;
00976    
00977    err = decodeFac(p, &(bc->fac_in));
00978    if (err) {
00979       cb_log(5, bc->port, "Decoding FACILITY failed! (%d)\n", err);
00980    }
00981 }

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

Definition at line 548 of file isdn_msg_parser.c.

00549 {
00550 #ifdef DEBUG 
00551    printf("Parsing HOLD Msg\n"); 
00552 #endif
00553 
00554  
00555 }

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

Definition at line 617 of file isdn_msg_parser.c.

00618 {
00619 #ifdef DEBUG 
00620    printf("Parsing HOLD_ACKNOWLEDGE Msg\n"); 
00621 #endif
00622 
00623  
00624 }

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

Definition at line 686 of file isdn_msg_parser.c.

00687 {
00688 #ifdef DEBUG 
00689    printf("Parsing HOLD_REJECT Msg\n"); 
00690 #endif
00691 
00692  
00693 }

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

Definition at line 1061 of file isdn_msg_parser.c.

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

01062 {
01063    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01064    INFORMATION_t *information=(INFORMATION_t*)((unsigned long)(msg->data+HEADER_LEN));
01065    {
01066       int  type, plan;
01067       char number[32];
01068       char keypad[32];
01069       dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *)information, &type, &plan, number, sizeof(number)-1, nt, bc);
01070       dec_ie_keypad(information->KEYPAD, (Q931_info_t *)information, keypad, sizeof(keypad)-1, nt, bc);
01071       strcpy(bc->info_dad, number);
01072       strcpy(bc->keypad,keypad);
01073    }
01074 #ifdef DEBUG 
01075    printf("Parsing INFORMATION Msg\n"); 
01076 #endif
01077 }

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

Definition at line 1019 of file isdn_msg_parser.c.

01020 {
01021 #ifdef DEBUG 
01022    printf("Parsing NOTIFY Msg\n"); 
01023 #endif
01024 }

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

Definition at line 57 of file isdn_msg_parser.c.

References 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().

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

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

Definition at line 132 of file isdn_msg_parser.c.

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

00133 {
00134    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00135    PROGRESS_t *progress=(PROGRESS_t*)((unsigned long)(msg->data+HEADER_LEN)); 
00136    //Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);  
00137    
00138    dec_ie_progress(progress->PROGRESS, (Q931_info_t *)progress, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00139    
00140 #ifdef DEBUG 
00141    printf("Parsing PROGRESS Msg\n"); 
00142 #endif
00143 }

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

Definition at line 861 of file isdn_msg_parser.c.

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

00862 {
00863    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00864    RELEASE_t *release=(RELEASE_t*)((unsigned long)(msg->data+HEADER_LEN));
00865    int location;
00866    int cause;
00867   
00868    dec_ie_cause(release->CAUSE, (Q931_info_t *)(release), &location, &cause, nt,bc);
00869    if (cause>0) bc->cause=cause;
00870 #ifdef DEBUG 
00871    printf("Parsing RELEASE Msg\n"); 
00872 #endif
00873 
00874  
00875 }

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

Definition at line 900 of file isdn_msg_parser.c.

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

00901 {
00902    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00903    RELEASE_COMPLETE_t *release_complete=(RELEASE_COMPLETE_t*)((unsigned long)(msg->data+HEADER_LEN));
00904    int location;
00905    int cause;
00906    iframe_t *frm = (iframe_t*) msg->data;
00907 
00908    struct misdn_stack *stack=get_stack_by_bc(bc);
00909    mISDNuser_head_t *hh;
00910    hh=(mISDNuser_head_t*)msg->data;
00911 
00912    /*hh=(mISDN_head_t*)msg->data;
00913    mISDN_head_t *hh;*/
00914 
00915    if (nt) {
00916       if (hh->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
00917          cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [NT] \n");
00918          return;
00919       }
00920    } else {
00921       if (frm->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
00922          cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [TE] \n");
00923          return;
00924       }
00925    }
00926    dec_ie_cause(release_complete->CAUSE, (Q931_info_t *)(release_complete), &location, &cause, nt,bc);
00927    if (cause>0) bc->cause=cause;
00928 
00929 #ifdef DEBUG 
00930    printf("Parsing RELEASE_COMPLETE Msg\n"); 
00931 #endif
00932 }

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

Definition at line 819 of file isdn_msg_parser.c.

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

00820 {
00821    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00822    RESTART_t *restart=(RESTART_t*)((unsigned long)(msg->data+HEADER_LEN));
00823 
00824    struct misdn_stack *stack=get_stack_by_bc(bc);
00825    
00826 #ifdef DEBUG 
00827    printf("Parsing RESTART Msg\n");
00828 #endif
00829   
00830    {
00831       int  exclusive;
00832       dec_ie_channel_id(restart->CHANNEL_ID, (Q931_info_t *)restart, &exclusive, &bc->restart_channel, nt,bc);
00833       cb_log(3, stack->port, "CC_RESTART Request on channel:%d on this port.\n", bc->restart_channel);
00834    }
00835  
00836 }

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

Definition at line 594 of file isdn_msg_parser.c.

00595 {
00596 #ifdef DEBUG 
00597    printf("Parsing RESUME Msg\n"); 
00598 #endif
00599 
00600  
00601 }

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

Definition at line 663 of file isdn_msg_parser.c.

00664 {
00665 #ifdef DEBUG 
00666    printf("Parsing RESUME_ACKNOWLEDGE Msg\n"); 
00667 #endif
00668 
00669  
00670 }

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

Definition at line 525 of file isdn_msg_parser.c.

00526 {
00527 #ifdef DEBUG 
00528    printf("Parsing RESUME_REJECT Msg\n"); 
00529 #endif
00530 
00531  
00532 }

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

Definition at line 709 of file isdn_msg_parser.c.

00710 {
00711 #ifdef DEBUG 
00712    printf("Parsing RETRIEVE Msg\n"); 
00713 #endif
00714 
00715  
00716 }

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

Definition at line 732 of file isdn_msg_parser.c.

00733 {
00734 #ifdef DEBUG 
00735    printf("Parsing RETRIEVE_ACKNOWLEDGE Msg\n"); 
00736 #endif
00737 
00738  
00739 }

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

Definition at line 756 of file isdn_msg_parser.c.

00757 {
00758 #ifdef DEBUG 
00759    printf("Parsing RETRIEVE_REJECT Msg\n"); 
00760 #endif
00761 
00762  
00763 }

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

Definition at line 159 of file isdn_msg_parser.c.

References 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.

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

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

Definition at line 414 of file isdn_msg_parser.c.

References 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().

00415 {
00416    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00417    SETUP_ACKNOWLEDGE_t *setup_acknowledge=(SETUP_ACKNOWLEDGE_t*)((unsigned long)(msg->data+HEADER_LEN));
00418 
00419    {
00420       int  exclusive, channel;
00421       dec_ie_channel_id(setup_acknowledge->CHANNEL_ID, (Q931_info_t *)setup_acknowledge, &exclusive, &channel, nt,bc);
00422 
00423 
00424       set_channel(bc, channel);
00425    }
00426    
00427    dec_ie_progress(setup_acknowledge->PROGRESS, (Q931_info_t *)setup_acknowledge, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00428 #ifdef DEBUG 
00429    printf("Parsing SETUP_ACKNOWLEDGE Msg\n"); 
00430 #endif
00431 
00432  
00433 }

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

Definition at line 1104 of file isdn_msg_parser.c.

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

01105 {
01106    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01107    STATUS_t *status=(STATUS_t*)((unsigned long)(msg->data+HEADER_LEN));
01108    int location;
01109    int cause;
01110   
01111    dec_ie_cause(status->CAUSE, (Q931_info_t *)(status), &location, &cause, nt,bc);
01112    if (cause>0) bc->cause=cause;
01113    ;
01114 
01115 #ifdef DEBUG 
01116    printf("Parsing STATUS Msg\n"); 
01117 #endif
01118 }

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

Definition at line 1040 of file isdn_msg_parser.c.

01041 {
01042 #ifdef DEBUG 
01043    printf("Parsing STATUS_ENQUIRY Msg\n"); 
01044 #endif
01045 }

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

Definition at line 571 of file isdn_msg_parser.c.

00572 {
00573 #ifdef DEBUG 
00574    printf("Parsing SUSPEND Msg\n"); 
00575 #endif
00576 
00577  
00578 }

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

Definition at line 640 of file isdn_msg_parser.c.

00641 {
00642 #ifdef DEBUG 
00643    printf("Parsing SUSPEND_ACKNOWLEDGE Msg\n"); 
00644 #endif
00645 
00646  
00647 }

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

Definition at line 502 of file isdn_msg_parser.c.

00503 {
00504 #ifdef DEBUG 
00505    printf("Parsing SUSPEND_REJECT Msg\n"); 
00506 #endif
00507 
00508  
00509 }

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

Definition at line 1134 of file isdn_msg_parser.c.

01135 {
01136 #ifdef DEBUG 
01137    printf("Parsing STATUS Msg\n"); 
01138 #endif 
01139 }

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

Definition at line 479 of file isdn_msg_parser.c.

00480 {
00481 #ifdef DEBUG 
00482    printf("Parsing USER_INFORMATION Msg\n"); 
00483 #endif
00484 
00485  
00486 }

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

Definition at line 29 of file isdn_msg_parser.c.

References 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().

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


Variable Documentation

char EVENT_BCHAN_ACTIVATED_INFO[] = "BCHAN_ACTIVATED"

Definition at line 1314 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_BCHAN_DATA_INFO[] = "BCHAN_DATA"

Definition at line 1313 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_BCHAN_ERROR_INFO[] = "BCHAN_ERROR"

Definition at line 1316 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_CLEAN_INFO[] = "CLEAN_UP"

Definition at line 1307 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_DTMF_TONE_INFO[] = "DTMF_TONE"

Definition at line 1308 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_NEW_BC_INFO[] = "NEW_BC"

Definition at line 1310 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_NEW_CHANNEL_INFO[] = "NEW_CHANNEL"

Definition at line 1312 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_NEW_L3ID_INFO[] = "NEW_L3ID"

Definition at line 1309 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_PORT_ALARM_INFO[] = "ALARM"

Definition at line 1311 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

char EVENT_TONE_GENERATE_INFO[] = "TONE_GENERATE"

Definition at line 1315 of file isdn_msg_parser.c.

Referenced by isdn_get_info().

struct isdn_msg msgs_g[]


Generated on Wed Oct 28 11:52:47 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6