Sat Mar 26 11:23:31 2011

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 void build_display_str (char *display, size_t display_length, int display_format, const char *name, const char *number)
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)
static void dec_ie_facility (unsigned char *p, Q931_info_t *qi, struct FacParm *fac, int nt, struct misdn_bchannel *bc)
static void enc_ie_facility (unsigned char **ntmode, msg_t *msg, struct FacParm *fac, 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 497 of file isdn_msg_parser.c.

Referenced by build_setup().

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

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

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

00236 {
00237    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00238    ALERTING_t *alerting;
00239    msg_t *msg =(msg_t*)create_l3msg(CC_ALERTING | REQUEST, MT_ALERTING,  bc?bc->l3_id:-1, sizeof(ALERTING_t) ,nt);
00240 
00241    alerting=(ALERTING_t*)((msg->data+HEADER_LEN));
00242 
00243    enc_ie_channel_id(&alerting->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
00244 
00245    if (nt)
00246       enc_ie_progress(&alerting->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
00247 
00248    if (bc->fac_out.Function != Fac_None) {
00249       enc_ie_facility(&alerting->FACILITY, msg, &bc->fac_out, nt);
00250    }
00251 
00252    /* enc_ie_redir_dn */
00253 
00254 #ifdef DEBUG
00255    printf("Building ALERTING Msg\n");
00256 #endif
00257    return msg;
00258 }

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

Definition at line 662 of file isdn_msg_parser.c.

References build_display_str(), cb_log, misdn_bchannel::connected, create_l3msg(), misdn_bchannel::display, misdn_bchannel::display_connected, enc_ie_connected_pn(), enc_ie_date(), enc_ie_display(), enc_ie_facility(), misdn_bchannel::fac_out, HEADER_LEN, misdn_bchannel::l3_id, mISDNUSER_HEAD_SIZE, misdn_party_id::name, misdn_party_id::number, misdn_party_id::number_plan, misdn_party_id::number_type, misdn_bchannel::outgoing_colp, misdn_bchannel::port, misdn_party_id::presentation, and misdn_party_id::screening.

00663 {
00664    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00665    CONNECT_t *connect;
00666    msg_t *msg =(msg_t*)create_l3msg(CC_CONNECT | REQUEST, MT_CONNECT,  bc?bc->l3_id:-1, sizeof(CONNECT_t) ,nt);
00667 
00668    cb_log(6,bc->port,"BUILD_CONNECT: bc:%p bc->l3id:%d, nt:%d\n",bc,bc->l3_id,nt);
00669 
00670    connect=(CONNECT_t*)((msg->data+HEADER_LEN));
00671 
00672    if (nt) {
00673       time_t now;
00674       time(&now);
00675       enc_ie_date(&connect->DATE, msg, now, nt,bc);
00676    }
00677 
00678    switch (bc->outgoing_colp) {
00679    case 0:/* pass */
00680    case 1:/* restricted */
00681       enc_ie_connected_pn(&connect->CONNECT_PN, msg, bc->connected.number_type,
00682          bc->connected.number_plan, bc->connected.presentation,
00683          bc->connected.screening, bc->connected.number, nt, bc);
00684       break;
00685    default:
00686       break;
00687    }
00688 
00689    if (nt && bc->connected.presentation == 0) {
00690       char display[sizeof(bc->display)];
00691 
00692       /* Presentation is allowed */
00693       build_display_str(display, sizeof(display), bc->display_connected, bc->connected.name, bc->connected.number);
00694       if (display[0]) {
00695          enc_ie_display(&connect->DISPLAY, msg, display, nt, bc);
00696       }
00697    }
00698 
00699    if (bc->fac_out.Function != Fac_None) {
00700       enc_ie_facility(&connect->FACILITY, msg, &bc->fac_out, nt);
00701    }
00702 
00703 #ifdef DEBUG
00704    printf("Building CONNECT Msg\n");
00705 #endif
00706    return msg;
00707 }

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

Definition at line 765 of file isdn_msg_parser.c.

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

00766 {
00767    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00768    CONNECT_ACKNOWLEDGE_t *connect_acknowledge;
00769    msg_t *msg =(msg_t*)create_l3msg(CC_CONNECT | RESPONSE, MT_CONNECT,  bc?bc->l3_id:-1, sizeof(CONNECT_ACKNOWLEDGE_t) ,nt);
00770 
00771    connect_acknowledge=(CONNECT_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
00772 
00773    enc_ie_channel_id(&connect_acknowledge->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
00774 
00775 #ifdef DEBUG
00776    printf("Building CONNECT_ACKNOWLEDGE Msg\n");
00777 #endif
00778    return msg;
00779 }

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

Definition at line 1100 of file isdn_msg_parser.c.

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

01101 {
01102    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01103    DISCONNECT_t *disconnect;
01104    msg_t *msg =(msg_t*)create_l3msg(CC_DISCONNECT | REQUEST, MT_DISCONNECT,  bc?bc->l3_id:-1, sizeof(DISCONNECT_t) ,nt);
01105 
01106    disconnect=(DISCONNECT_t*)((msg->data+HEADER_LEN));
01107 
01108    enc_ie_cause(&disconnect->CAUSE, msg, (nt)?1:0, bc->out_cause,nt,bc);
01109    if (nt) {
01110       enc_ie_progress(&disconnect->PROGRESS, msg, 0, nt ? 1 : 5, 8, nt, bc);
01111    }
01112 
01113    if (bc->fac_out.Function != Fac_None) {
01114       enc_ie_facility(&disconnect->FACILITY, msg, &bc->fac_out, nt);
01115    }
01116 
01117    if (bc->uulen) {
01118       int  protocol=4;
01119       enc_ie_useruser(&disconnect->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
01120       cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
01121    }
01122 
01123 #ifdef DEBUG
01124    printf("Building DISCONNECT Msg\n");
01125 #endif
01126    return msg;
01127 }

static void build_display_str ( char *  display,
size_t  display_length,
int  display_format,
const char *  name,
const char *  number 
) [static]

Definition at line 40 of file isdn_msg_parser.c.

Referenced by build_connect(), and build_setup().

00041 {
00042    display[0] = 0;
00043    switch (display_format) {
00044    default:
00045    case 0:     /* none */
00046       break;
00047 
00048    case 1:     /* name */
00049       snprintf(display, display_length, "%s", name);
00050       break;
00051 
00052    case 2:     /* number */
00053       snprintf(display, display_length, "%s", number);
00054       break;
00055 
00056    case 3:     /* both */
00057       if (name[0] || number[0]) {
00058          snprintf(display, display_length, "\"%s\" <%s>", name, number);
00059       }
00060       break;
00061    }
00062 }

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

Definition at line 1344 of file isdn_msg_parser.c.

References create_l3msg(), misdn_bchannel::display, enc_ie_display(), enc_ie_notify(), enc_ie_redir_dn(), misdn_bchannel::fac_out, HEADER_LEN, misdn_bchannel::l3_id, len(), mISDN_NOTIFY_CODE_INVALID, mISDNUSER_HEAD_SIZE, misdn_bchannel::notify_description_code, misdn_bchannel::nt, misdn_party_id::number, misdn_party_id::number_plan, misdn_party_id::number_type, misdn_bchannel::outgoing_colp, misdn_party_id::presentation, misdn_bchannel::redirecting, misdn_party_redirecting::to, and misdn_party_redirecting::to_changed.

01345 {
01346    int len;
01347    int HEADER_LEN;
01348    unsigned char *ie_fac;
01349    unsigned char fac_tmp[256];
01350    msg_t *msg;
01351    FACILITY_t *facility;
01352    Q931_info_t *qi;
01353 
01354 #ifdef DEBUG
01355    printf("Building FACILITY Msg\n");
01356 #endif
01357 
01358    len = encodeFac(fac_tmp, &(bc->fac_out));
01359    if (len <= 0) {
01360       /*
01361        * mISDN does not know how to build the requested facility structure
01362        * Clear facility information
01363        */
01364       bc->fac_out.Function = Fac_None;
01365 
01366 #if defined(AST_MISDN_ENHANCEMENTS)
01367       /* Clear other one shot information. */
01368       bc->notify_description_code = mISDN_NOTIFY_CODE_INVALID;
01369       bc->redirecting.to_changed = 0;
01370 #endif   /* defined(AST_MISDN_ENHANCEMENTS) */
01371       return NULL;
01372    }
01373 
01374    msg = (msg_t *) create_l3msg(CC_FACILITY | REQUEST, MT_FACILITY, bc ? bc->l3_id : -1, sizeof(FACILITY_t), nt);
01375    HEADER_LEN = nt ? mISDNUSER_HEAD_SIZE : mISDN_HEADER_LEN;
01376    facility = (FACILITY_t *) (msg->data + HEADER_LEN);
01377 
01378    ie_fac = msg_put(msg, len);
01379    if (bc->nt) {
01380       facility->FACILITY = ie_fac + 1;
01381    } else {
01382       qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
01383       qi->QI_ELEMENT(facility) = ie_fac - (unsigned char *)qi - sizeof(Q931_info_t);
01384    }
01385 
01386    memcpy(ie_fac, fac_tmp, len);
01387 
01388    /* Clear facility information */
01389    bc->fac_out.Function = Fac_None;
01390 
01391    if (*bc->display) {
01392 #ifdef DEBUG
01393       printf("Sending %s as Display\n", bc->display);
01394 #endif
01395       enc_ie_display(&facility->DISPLAY, msg, bc->display, nt,bc);
01396    }
01397 
01398 #if defined(AST_MISDN_ENHANCEMENTS)
01399    if (bc->notify_description_code != mISDN_NOTIFY_CODE_INVALID) {
01400       enc_ie_notify(&facility->NOTIFY, msg, bc->notify_description_code, nt, bc);
01401       bc->notify_description_code = mISDN_NOTIFY_CODE_INVALID;
01402    }
01403 
01404    if (bc->redirecting.to_changed) {
01405       bc->redirecting.to_changed = 0;
01406       switch (bc->outgoing_colp) {
01407       case 0:/* pass */
01408       case 1:/* restricted */
01409          enc_ie_redir_dn(&facility->REDIR_DN, msg, bc->redirecting.to.number_type,
01410             bc->redirecting.to.number_plan, bc->redirecting.to.presentation,
01411             bc->redirecting.to.number, nt, bc);
01412          break;
01413       default:
01414          break;
01415       }
01416    }
01417 #endif   /* defined(AST_MISDN_ENHANCEMENTS) */
01418 
01419    return msg;
01420 }

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

Definition at line 859 of file isdn_msg_parser.c.

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

00860 {
00861    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00862    HOLD_t *hold;
00863    msg_t *msg =(msg_t*)create_l3msg(CC_HOLD | REQUEST, MT_HOLD,  bc?bc->l3_id:-1, sizeof(HOLD_t) ,nt);
00864 
00865    hold=(HOLD_t*)((msg->data+HEADER_LEN));
00866 
00867 #ifdef DEBUG
00868    printf("Building HOLD Msg\n");
00869 #endif
00870    return msg;
00871 }

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

Definition at line 928 of file isdn_msg_parser.c.

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

00929 {
00930    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00931    HOLD_ACKNOWLEDGE_t *hold_acknowledge;
00932    msg_t *msg =(msg_t*)create_l3msg(CC_HOLD_ACKNOWLEDGE | REQUEST, MT_HOLD_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(HOLD_ACKNOWLEDGE_t) ,nt);
00933 
00934    hold_acknowledge=(HOLD_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
00935 
00936 #ifdef DEBUG
00937    printf("Building HOLD_ACKNOWLEDGE Msg\n");
00938 #endif
00939    return msg;
00940 }

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

Definition at line 997 of file isdn_msg_parser.c.

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

00998 {
00999    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01000    HOLD_REJECT_t *hold_reject;
01001    msg_t *msg =(msg_t*)create_l3msg(CC_HOLD_REJECT | REQUEST, MT_HOLD_REJECT,  bc?bc->l3_id:-1, sizeof(HOLD_REJECT_t) ,nt);
01002 
01003    hold_reject=(HOLD_REJECT_t*)((msg->data+HEADER_LEN));
01004 
01005 #ifdef DEBUG
01006    printf("Building HOLD_REJECT Msg\n");
01007 #endif
01008    return msg;
01009 }

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

Definition at line 1590 of file isdn_msg_parser.c.

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

01591 {
01592    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01593    INFORMATION_t *information;
01594    msg_t *msg =(msg_t*)create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION,  bc?bc->l3_id:-1, sizeof(INFORMATION_t) ,nt);
01595 
01596    information=(INFORMATION_t*)((msg->data+HEADER_LEN));
01597 
01598    enc_ie_called_pn(&information->CALLED_PN, msg, 0, 1, bc->info_dad, nt,bc);
01599 
01600    {
01601       if (*bc->display) {
01602 #ifdef DEBUG
01603          printf("Sending %s as Display\n", bc->display);
01604 #endif
01605          enc_ie_display(&information->DISPLAY, msg, bc->display, nt,bc);
01606       }
01607    }
01608 
01609 #ifdef DEBUG
01610    printf("Building INFORMATION Msg\n");
01611 #endif
01612    return msg;
01613 }

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

Definition at line 1524 of file isdn_msg_parser.c.

References create_l3msg(), enc_ie_notify(), enc_ie_redir_dn(), misdn_bchannel::l3_id, mISDN_NOTIFY_CODE_INVALID, mISDNUSER_HEAD_SIZE, misdn_bchannel::notify_description_code, misdn_party_id::number, misdn_party_id::number_plan, misdn_party_id::number_type, misdn_bchannel::outgoing_colp, misdn_party_id::presentation, misdn_bchannel::redirecting, misdn_party_redirecting::to, and misdn_party_redirecting::to_changed.

01525 {
01526    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01527    NOTIFY_t *notify;
01528    msg_t *msg =(msg_t*)create_l3msg(CC_NOTIFY | REQUEST, MT_NOTIFY,  bc?bc->l3_id:-1, sizeof(NOTIFY_t) ,nt);
01529 
01530 #ifdef DEBUG
01531    printf("Building NOTIFY Msg\n");
01532 #endif
01533 
01534    notify = (NOTIFY_t *) (msg->data + HEADER_LEN);
01535 
01536    enc_ie_notify(&notify->NOTIFY, msg, bc->notify_description_code, nt, bc);
01537    bc->notify_description_code = mISDN_NOTIFY_CODE_INVALID;
01538 
01539    if (bc->redirecting.to_changed) {
01540       bc->redirecting.to_changed = 0;
01541       switch (bc->outgoing_colp) {
01542       case 0:/* pass */
01543       case 1:/* restricted */
01544          enc_ie_redir_dn(&notify->REDIR_DN, msg, bc->redirecting.to.number_type,
01545             bc->redirecting.to.number_plan, bc->redirecting.to.presentation,
01546             bc->redirecting.to.number, nt, bc);
01547          break;
01548       default:
01549          break;
01550       }
01551    }
01552    return msg;
01553 }

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

Definition at line 191 of file isdn_msg_parser.c.

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

00192 {
00193    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00194    CALL_PROCEEDING_t *proceeding;
00195    msg_t *msg =(msg_t*)create_l3msg(CC_PROCEEDING | REQUEST, MT_CALL_PROCEEDING,  bc?bc->l3_id:-1, sizeof(CALL_PROCEEDING_t) ,nt);
00196 
00197    proceeding=(CALL_PROCEEDING_t*)((msg->data+HEADER_LEN));
00198 
00199    enc_ie_channel_id(&proceeding->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
00200 
00201    if (nt)
00202       enc_ie_progress(&proceeding->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
00203 
00204    if (bc->fac_out.Function != Fac_None) {
00205       enc_ie_facility(&proceeding->FACILITY, msg, &bc->fac_out, nt);
00206    }
00207 
00208    /* enc_ie_redir_dn */
00209 
00210 #ifdef DEBUG
00211    printf("Building PROCEEDING Msg\n");
00212 #endif
00213    return msg;
00214 }

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

Definition at line 276 of file isdn_msg_parser.c.

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

00277 {
00278    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00279    PROGRESS_t *progress;
00280    msg_t *msg =(msg_t*)create_l3msg(CC_PROGRESS | REQUEST, MT_PROGRESS,  bc?bc->l3_id:-1, sizeof(PROGRESS_t) ,nt);
00281 
00282    progress=(PROGRESS_t*)((msg->data+HEADER_LEN));
00283 
00284    if (bc->fac_out.Function != Fac_None) {
00285       enc_ie_facility(&progress->FACILITY, msg, &bc->fac_out, nt);
00286    }
00287 
00288 #ifdef DEBUG
00289    printf("Building PROGRESS Msg\n");
00290 #endif
00291    return msg;
00292 }

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

Definition at line 1190 of file isdn_msg_parser.c.

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

01191 {
01192    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01193    RELEASE_t *release;
01194    msg_t *msg =(msg_t*)create_l3msg(CC_RELEASE | REQUEST, MT_RELEASE,  bc?bc->l3_id:-1, sizeof(RELEASE_t) ,nt);
01195 
01196    release=(RELEASE_t*)((msg->data+HEADER_LEN));
01197 
01198    if (bc->out_cause>= 0)
01199       enc_ie_cause(&release->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
01200 
01201    if (bc->fac_out.Function != Fac_None) {
01202       enc_ie_facility(&release->FACILITY, msg, &bc->fac_out, nt);
01203    }
01204 
01205    if (bc->uulen) {
01206       int  protocol=4;
01207       enc_ie_useruser(&release->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
01208       cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
01209    }
01210 
01211 #ifdef DEBUG
01212    printf("Building RELEASE Msg\n");
01213 #endif
01214    return msg;
01215 }

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

Definition at line 1253 of file isdn_msg_parser.c.

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

01254 {
01255    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01256    RELEASE_COMPLETE_t *release_complete;
01257    msg_t *msg =(msg_t*)create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE,  bc?bc->l3_id:-1, sizeof(RELEASE_COMPLETE_t) ,nt);
01258 
01259    release_complete=(RELEASE_COMPLETE_t*)((msg->data+HEADER_LEN));
01260 
01261    enc_ie_cause(&release_complete->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
01262 
01263    if (bc->fac_out.Function != Fac_None) {
01264       enc_ie_facility(&release_complete->FACILITY, msg, &bc->fac_out, nt);
01265    }
01266 
01267    if (bc->uulen) {
01268       int  protocol=4;
01269       enc_ie_useruser(&release_complete->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
01270       cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
01271    }
01272 
01273 #ifdef DEBUG
01274    printf("Building RELEASE_COMPLETE Msg\n");
01275 #endif
01276    return msg;
01277 }

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

Definition at line 1148 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, and misdn_bchannel::port.

01149 {
01150    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01151    RESTART_t *restart;
01152    msg_t *msg =(msg_t*)create_l3msg(CC_RESTART | REQUEST, MT_RESTART,  bc?bc->l3_id:-1, sizeof(RESTART_t) ,nt);
01153 
01154    restart=(RESTART_t*)((msg->data+HEADER_LEN));
01155 
01156 #ifdef DEBUG
01157    printf("Building RESTART Msg\n");
01158 #endif
01159 
01160    if (bc->channel > 0) {
01161       enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
01162       enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x80, nt, bc);
01163    } else {
01164       enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x87, nt, bc);
01165    }
01166 
01167    cb_log(0,bc->port, "Restarting channel %d\n", bc->channel);
01168    return msg;
01169 }

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

Definition at line 905 of file isdn_msg_parser.c.

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

00906 {
00907    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00908    RESUME_t *resume;
00909    msg_t *msg =(msg_t*)create_l3msg(CC_RESUME | REQUEST, MT_RESUME,  bc?bc->l3_id:-1, sizeof(RESUME_t) ,nt);
00910 
00911    resume=(RESUME_t*)((msg->data+HEADER_LEN));
00912 
00913 #ifdef DEBUG
00914    printf("Building RESUME Msg\n");
00915 #endif
00916    return msg;
00917 }

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

Definition at line 974 of file isdn_msg_parser.c.

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

00975 {
00976    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00977    RESUME_ACKNOWLEDGE_t *resume_acknowledge;
00978    msg_t *msg =(msg_t*)create_l3msg(CC_RESUME_ACKNOWLEDGE | REQUEST, MT_RESUME_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(RESUME_ACKNOWLEDGE_t) ,nt);
00979 
00980    resume_acknowledge=(RESUME_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
00981 
00982 #ifdef DEBUG
00983    printf("Building RESUME_ACKNOWLEDGE Msg\n");
00984 #endif
00985    return msg;
00986 }

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

Definition at line 836 of file isdn_msg_parser.c.

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

00837 {
00838    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00839    RESUME_REJECT_t *resume_reject;
00840    msg_t *msg =(msg_t*)create_l3msg(CC_RESUME_REJECT | REQUEST, MT_RESUME_REJECT,  bc?bc->l3_id:-1, sizeof(RESUME_REJECT_t) ,nt);
00841 
00842    resume_reject=(RESUME_REJECT_t*)((msg->data+HEADER_LEN));
00843 
00844 #ifdef DEBUG
00845    printf("Building RESUME_REJECT Msg\n");
00846 #endif
00847    return msg;
00848 }

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

Definition at line 1020 of file isdn_msg_parser.c.

References 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    RETRIEVE_t *retrieve;
01024    msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE | REQUEST, MT_RETRIEVE,  bc?bc->l3_id:-1, sizeof(RETRIEVE_t) ,nt);
01025 
01026    retrieve=(RETRIEVE_t*)((msg->data+HEADER_LEN));
01027 
01028 #ifdef DEBUG
01029    printf("Building RETRIEVE Msg\n");
01030 #endif
01031    return msg;
01032 }

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

Definition at line 1043 of file isdn_msg_parser.c.

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

01044 {
01045    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01046    RETRIEVE_ACKNOWLEDGE_t *retrieve_acknowledge;
01047    msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE_ACKNOWLEDGE | REQUEST, MT_RETRIEVE_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(RETRIEVE_ACKNOWLEDGE_t) ,nt);
01048 
01049    retrieve_acknowledge=(RETRIEVE_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
01050 
01051    enc_ie_channel_id(&retrieve_acknowledge->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
01052 #ifdef DEBUG
01053    printf("Building RETRIEVE_ACKNOWLEDGE Msg\n");
01054 #endif
01055    return msg;
01056 }

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

Definition at line 1067 of file isdn_msg_parser.c.

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

01068 {
01069    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01070    RETRIEVE_REJECT_t *retrieve_reject;
01071    msg_t *msg =(msg_t*)create_l3msg(CC_RETRIEVE_REJECT | REQUEST, MT_RETRIEVE_REJECT,  bc?bc->l3_id:-1, sizeof(RETRIEVE_REJECT_t) ,nt);
01072 
01073    retrieve_reject=(RETRIEVE_REJECT_t*)((msg->data+HEADER_LEN));
01074 
01075 #ifdef DEBUG
01076    printf("Building RETRIEVE_REJECT Msg\n");
01077 #endif
01078    return msg;
01079 }

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

Definition at line 498 of file isdn_msg_parser.c.

References ANY_CHANNEL, build_display_str(), misdn_bchannel::caller, misdn_bchannel::capability, capability, cb_log, misdn_bchannel::channel, create_l3msg(), misdn_bchannel::dialed, misdn_bchannel::display, misdn_bchannel::display_setup, enc_ie_bearer(), enc_ie_called_pn(), enc_ie_calling_pn(), enc_ie_channel_id(), enc_ie_complete(), enc_ie_display(), enc_ie_facility(), enc_ie_keypad(), enc_ie_redir_nr(), enc_ie_useruser(), misdn_bchannel::fac_out, misdn_party_redirecting::from, 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, misdn_party_id::name, misdn_party_dialing::number, misdn_party_id::number, misdn_party_dialing::number_plan, misdn_party_id::number_plan, misdn_party_dialing::number_type, misdn_party_id::number_type, misdn_bchannel::outgoing_colp, misdn_bchannel::port, misdn_party_id::presentation, misdn_bchannel::rate, misdn_party_redirecting::reason, misdn_bchannel::redirecting, misdn_party_id::screening, misdn_bchannel::sending_complete, misdn_bchannel::uu, and misdn_bchannel::uulen.

00499 {
00500    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00501    SETUP_t *setup;
00502    msg_t *msg =(msg_t*)create_l3msg(CC_SETUP | REQUEST, MT_SETUP,  bc?bc->l3_id:-1, sizeof(SETUP_t) ,nt);
00503 
00504    setup=(SETUP_t*)((msg->data+HEADER_LEN));
00505 
00506    if (bc->channel == 0 || bc->channel == ANY_CHANNEL || bc->channel==-1)
00507       enc_ie_channel_id(&setup->CHANNEL_ID, msg, 0, bc->channel, nt,bc);
00508    else
00509       enc_ie_channel_id(&setup->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
00510 
00511    if (bc->fac_out.Function != Fac_None) {
00512       enc_ie_facility(&setup->FACILITY, msg, &bc->fac_out, nt);
00513    }
00514 
00515    enc_ie_calling_pn(&setup->CALLING_PN, msg, bc->caller.number_type, bc->caller.number_plan,
00516       bc->caller.presentation, bc->caller.screening, bc->caller.number, nt, bc);
00517 
00518    if (bc->dialed.number[0]) {
00519       enc_ie_called_pn(&setup->CALLED_PN, msg, bc->dialed.number_type, bc->dialed.number_plan, bc->dialed.number, nt, bc);
00520    }
00521 
00522    switch (bc->outgoing_colp) {
00523    case 0:/* pass */
00524    case 1:/* restricted */
00525       if (bc->redirecting.from.number[0]) {
00526 #if 1
00527          /* ETSI and Q.952 do not define the screening field */
00528          enc_ie_redir_nr(&setup->REDIR_NR, msg, bc->redirecting.from.number_type,
00529             bc->redirecting.from.number_plan, bc->redirecting.from.presentation, 0,
00530             bc->redirecting.reason, bc->redirecting.from.number, nt, bc);
00531 #else
00532          /* Q.931 defines the screening field */
00533          enc_ie_redir_nr(&setup->REDIR_NR, msg, bc->redirecting.from.number_type,
00534             bc->redirecting.from.number_plan, bc->redirecting.from.presentation,
00535             bc->redirecting.from.screening, bc->redirecting.reason,
00536             bc->redirecting.from.number, nt, bc);
00537 #endif
00538       }
00539       break;
00540    default:
00541       break;
00542    }
00543 
00544    if (bc->keypad[0]) {
00545       enc_ie_keypad(&setup->KEYPAD, msg, bc->keypad, nt,bc);
00546    }
00547 
00548 
00549 
00550    if (*bc->display) {
00551       enc_ie_display(&setup->DISPLAY, msg, bc->display, nt, bc);
00552    } else if (nt && bc->caller.presentation == 0) {
00553       char display[sizeof(bc->display)];
00554 
00555       /* Presentation is allowed */
00556       build_display_str(display, sizeof(display), bc->display_setup, bc->caller.name, bc->caller.number);
00557       if (display[0]) {
00558          enc_ie_display(&setup->DISPLAY, msg, display, nt, bc);
00559       }
00560    }
00561 
00562    {
00563       int coding = 0;
00564       int capability;
00565       int mode = 0;  /* 2 for packet! */
00566       int user;
00567       int rate = 0x10;
00568 
00569       switch (bc->law) {
00570       case INFO_CODEC_ULAW: user=2;
00571          break;
00572       case INFO_CODEC_ALAW: user=3;
00573          break;
00574       default:
00575          user=3;
00576       }
00577 
00578       switch (bc->capability) {
00579       case INFO_CAPABILITY_SPEECH: capability = 0;
00580          break;
00581       case INFO_CAPABILITY_DIGITAL_UNRESTRICTED: capability = 8;
00582          user=-1;
00583          mode=bc->mode;
00584          rate=bc->rate;
00585          break;
00586       case INFO_CAPABILITY_DIGITAL_RESTRICTED: capability = 9;
00587          user=-1;
00588          break;
00589       default:
00590          capability=bc->capability;
00591       }
00592 
00593       enc_ie_bearer(&setup->BEARER, msg, coding, capability, mode, rate, -1, user, nt,bc);
00594    }
00595 
00596    if (bc->sending_complete) {
00597       enc_ie_complete(&setup->COMPLETE,msg, bc->sending_complete, nt, bc);
00598    }
00599 
00600    if (bc->uulen) {
00601       int  protocol=4;
00602       enc_ie_useruser(&setup->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
00603       cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
00604    }
00605 
00606 #if defined(AST_MISDN_ENHANCEMENTS)
00607    extract_setup_Bc_Hlc_Llc(setup, nt, bc);
00608 #endif   /* defined(AST_MISDN_ENHANCEMENTS) */
00609 
00610 #ifdef DEBUG
00611    printf("Building SETUP Msg\n");
00612 #endif
00613    return msg;
00614 }

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

Definition at line 733 of file isdn_msg_parser.c.

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

00734 {
00735    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00736    SETUP_ACKNOWLEDGE_t *setup_acknowledge;
00737    msg_t *msg =(msg_t*)create_l3msg(CC_SETUP_ACKNOWLEDGE | REQUEST, MT_SETUP_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(SETUP_ACKNOWLEDGE_t) ,nt);
00738 
00739    setup_acknowledge=(SETUP_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
00740 
00741    enc_ie_channel_id(&setup_acknowledge->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
00742 
00743    if (nt)
00744       enc_ie_progress(&setup_acknowledge->PROGRESS, msg, 0, nt?1:5, 8, nt,bc);
00745 
00746    if (bc->fac_out.Function != Fac_None) {
00747       enc_ie_facility(&setup_acknowledge->FACILITY, msg, &bc->fac_out, nt);
00748    }
00749 
00750 #ifdef DEBUG
00751    printf("Building SETUP_ACKNOWLEDGE Msg\n");
00752 #endif
00753    return msg;
00754 }

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

Definition at line 1630 of file isdn_msg_parser.c.

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

01631 {
01632    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01633    STATUS_t *status;
01634    msg_t *msg =(msg_t*)create_l3msg(CC_STATUS | REQUEST, MT_STATUS,  bc?bc->l3_id:-1, sizeof(STATUS_t) ,nt);
01635 
01636    status=(STATUS_t*)((msg->data+HEADER_LEN));
01637 
01638 #ifdef DEBUG
01639    printf("Building STATUS Msg\n");
01640 #endif
01641    return msg;
01642 }

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

Definition at line 1562 of file isdn_msg_parser.c.

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

01563 {
01564    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01565    STATUS_ENQUIRY_t *status_enquiry;
01566    msg_t *msg =(msg_t*)create_l3msg(CC_STATUS_ENQUIRY | REQUEST, MT_STATUS_ENQUIRY,  bc?bc->l3_id:-1, sizeof(STATUS_ENQUIRY_t) ,nt);
01567 
01568    status_enquiry=(STATUS_ENQUIRY_t*)((msg->data+HEADER_LEN));
01569 
01570 #ifdef DEBUG
01571    printf("Building STATUS_ENQUIRY Msg\n");
01572 #endif
01573    return msg;
01574 }

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

Definition at line 882 of file isdn_msg_parser.c.

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

00883 {
00884    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00885    SUSPEND_t *suspend;
00886    msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND | REQUEST, MT_SUSPEND,  bc?bc->l3_id:-1, sizeof(SUSPEND_t) ,nt);
00887 
00888    suspend=(SUSPEND_t*)((msg->data+HEADER_LEN));
00889 
00890 #ifdef DEBUG
00891    printf("Building SUSPEND Msg\n");
00892 #endif
00893    return msg;
00894 }

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

Definition at line 951 of file isdn_msg_parser.c.

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

00952 {
00953    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00954    SUSPEND_ACKNOWLEDGE_t *suspend_acknowledge;
00955    msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND_ACKNOWLEDGE | REQUEST, MT_SUSPEND_ACKNOWLEDGE,  bc?bc->l3_id:-1, sizeof(SUSPEND_ACKNOWLEDGE_t) ,nt);
00956 
00957    suspend_acknowledge=(SUSPEND_ACKNOWLEDGE_t*)((msg->data+HEADER_LEN));
00958 
00959 #ifdef DEBUG
00960    printf("Building SUSPEND_ACKNOWLEDGE Msg\n");
00961 #endif
00962    return msg;
00963 }

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

Definition at line 813 of file isdn_msg_parser.c.

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

00814 {
00815    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00816    SUSPEND_REJECT_t *suspend_reject;
00817    msg_t *msg =(msg_t*)create_l3msg(CC_SUSPEND_REJECT | REQUEST, MT_SUSPEND_REJECT,  bc?bc->l3_id:-1, sizeof(SUSPEND_REJECT_t) ,nt);
00818 
00819    suspend_reject=(SUSPEND_REJECT_t*)((msg->data+HEADER_LEN));
00820 
00821 #ifdef DEBUG
00822    printf("Building SUSPEND_REJECT Msg\n");
00823 #endif
00824    return msg;
00825 }

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

Definition at line 1651 of file isdn_msg_parser.c.

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

01652 {
01653    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01654    STATUS_t *status;
01655    msg_t *msg =(msg_t*)create_l3msg(CC_STATUS | REQUEST, MT_STATUS,  bc?bc->l3_id:-1, sizeof(STATUS_t) ,nt);
01656 
01657    status=(STATUS_t*)((msg->data+HEADER_LEN));
01658 
01659 #ifdef DEBUG
01660    printf("Building STATUS Msg\n");
01661 #endif
01662    return msg;
01663 }

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

Definition at line 790 of file isdn_msg_parser.c.

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

00791 {
00792    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00793    USER_INFORMATION_t *user_information;
00794    msg_t *msg =(msg_t*)create_l3msg(CC_USER_INFORMATION | REQUEST, MT_USER_INFORMATION,  bc?bc->l3_id:-1, sizeof(USER_INFORMATION_t) ,nt);
00795 
00796    user_information=(USER_INFORMATION_t*)((msg->data+HEADER_LEN));
00797 
00798 #ifdef DEBUG
00799    printf("Building USER_INFORMATION Msg\n");
00800 #endif
00801    return msg;
00802 }

static void dec_ie_facility ( unsigned char *  p,
Q931_info_t *  qi,
struct FacParm *  fac,
int  nt,
struct misdn_bchannel *  bc 
) [static]

Definition at line 118 of file isdn_msg_parser.c.

References cb_log, and misdn_bchannel::port.

Referenced by parse_alerting(), parse_connect(), parse_disconnect(), parse_proceeding(), parse_progress(), parse_release(), parse_release_complete(), parse_setup(), and parse_setup_acknowledge().

00119 {
00120    fac->Function = Fac_None;
00121 
00122    if (!nt) {
00123       p = NULL;
00124       if (qi->QI_ELEMENT(facility)) {
00125          p = (unsigned char *) qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(facility) + 1;
00126       }
00127    }
00128    if (!p) {
00129       return;
00130    }
00131 
00132    if (decodeFac(p, fac)) {
00133       cb_log(3, bc->port, "Decoding facility ie failed! Unrecognized facility message?\n");
00134    }
00135 }

static void enc_ie_facility ( unsigned char **  ntmode,
msg_t *  msg,
struct FacParm *  fac,
int  nt 
) [static]

Definition at line 75 of file isdn_msg_parser.c.

References len().

Referenced by build_alerting(), build_connect(), build_disconnect(), build_proceeding(), build_progress(), build_release(), build_release_complete(), build_setup(), and build_setup_acknowledge().

00076 {
00077    int len;
00078    Q931_info_t *qi;
00079    unsigned char *p;
00080    unsigned char buf[256];
00081 
00082    len = encodeFac(buf, fac);
00083    if (len <= 0) {
00084       /*
00085        * mISDN does not know how to build the requested facility structure
00086        * Clear facility information
00087        */
00088       fac->Function = Fac_None;
00089       return;
00090    }
00091 
00092    p = msg_put(msg, len);
00093    if (nt) {
00094       *ntmode = p + 1;
00095    } else {
00096       qi = (Q931_info_t *) (msg->data + mISDN_HEADER_LEN);
00097       qi->QI_ELEMENT(facility) = p - (unsigned char *) qi - sizeof(Q931_info_t);
00098    }
00099 
00100    memcpy(p, buf, len);
00101 
00102    /* Clear facility information */
00103    fac->Function = Fac_None;
00104 }

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

Definition at line 1774 of file isdn_msg_parser.c.

References EVENT_BCHAN_ACTIVATED, EVENT_BCHAN_DATA, EVENT_BCHAN_ERROR, EVENT_CLEANUP, EVENT_DTMF_TONE, EVENT_NEW_BC, EVENT_NEW_CHANNEL, EVENT_NEW_L3ID, EVENT_PORT_ALARM, EVENT_TONE_GENERATE, 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().

01775 {
01776    int i=isdn_msg_get_index_by_event(msgs, event, nt);
01777 
01778    if(i>=0) return msgs[i].info;
01779 
01780    if (event == EVENT_CLEANUP) return EVENT_CLEAN_INFO;
01781    if (event == EVENT_DTMF_TONE) return EVENT_DTMF_TONE_INFO;
01782    if (event == EVENT_NEW_L3ID) return EVENT_NEW_L3ID_INFO;
01783    if (event == EVENT_NEW_BC) return EVENT_NEW_BC_INFO;
01784    if (event == EVENT_NEW_CHANNEL) return EVENT_NEW_CHANNEL_INFO;
01785    if (event == EVENT_BCHAN_DATA) return EVENT_BCHAN_DATA_INFO;
01786    if (event == EVENT_BCHAN_ACTIVATED) return EVENT_BCHAN_ACTIVATED_INFO;
01787    if (event == EVENT_TONE_GENERATE) return EVENT_TONE_GENERATE_INFO;
01788    if (event == EVENT_PORT_ALARM) return EVENT_PORT_ALARM_INFO;
01789    if (event == EVENT_BCHAN_ERROR) return EVENT_BCHAN_ERROR_INFO;
01790 
01791    return NULL;
01792 }

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

Definition at line 1803 of file isdn_msg_parser.c.

References isdn_msg_get_index_by_event(), and isdn_msg::msg_builder.

Referenced by misdn_lib_send_event().

01804 {
01805    int i=isdn_msg_get_index_by_event(msgs, event, nt);
01806    if(i<0) return NULL;
01807 
01808    return  msgs[i].msg_builder(msgs, bc, nt);
01809 }

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

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

01749 {
01750    int i=isdn_msg_get_index(msgs, msg, nt);
01751    if(i>=0) return msgs[i].event;
01752    return EVENT_UNKNOWN;
01753 }

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

INTERFACE FCTS

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

01717 {
01718    int i;
01719 
01720    if (nt){
01721       mISDNuser_head_t *hh = (mISDNuser_head_t*)msg->data;
01722 
01723       for (i=0; i< msgs_max -1; i++) {
01724          if ( (hh->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
01725       }
01726 
01727    } else {
01728       iframe_t *frm = (iframe_t*)msg->data;
01729 
01730       for (i=0; i< msgs_max -1; i++)
01731          if ( (frm->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
01732    }
01733 
01734    return -1;
01735 }

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

Definition at line 1737 of file isdn_msg_parser.c.

References cb_log, and msgs_max.

Referenced by isdn_get_info(), and isdn_msg_build_event().

01738 {
01739    int i;
01740    for (i=0; i< msgs_max; i++)
01741       if ( event == msgs[i].event) return i;
01742 
01743    cb_log(10,0, "get_index: event not found!\n");
01744 
01745    return -1;
01746 }

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

Definition at line 1755 of file isdn_msg_parser.c.

References isdn_msg::info, and isdn_msg_get_index().

01756 {
01757    int i=isdn_msg_get_index(msgs, msg, nt);
01758    if(i>=0) return msgs[i].info;
01759    return NULL;
01760 }

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

Definition at line 1794 of file isdn_msg_parser.c.

References isdn_msg_get_index(), and isdn_msg::msg_parser.

Referenced by handle_event_nt(), and handle_frm().

01795 {
01796    int i=isdn_msg_get_index(msgs, msg, nt);
01797    if(i<0) return -1;
01798 
01799    msgs[i].msg_parser(msgs, msg, bc, nt);
01800    return 0;
01801 }

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

Definition at line 216 of file isdn_msg_parser.c.

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

00217 {
00218    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00219    ALERTING_t *alerting = (ALERTING_t *) (msg->data + HEADER_LEN);
00220    //Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);
00221 
00222    dec_ie_facility(alerting->FACILITY, (Q931_info_t *) alerting, &bc->fac_in, nt, bc);
00223 
00224    /* dec_ie_redir_dn */
00225 
00226    dec_ie_progress(alerting->PROGRESS, (Q931_info_t *)alerting, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00227 
00228 #ifdef DEBUG
00229    printf("Parsing ALERTING Msg\n");
00230 #endif
00231 
00232 
00233 }

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

Definition at line 616 of file isdn_msg_parser.c.

References misdn_bchannel::ces, misdn_bchannel::connected, dec_ie_connected_pn(), dec_ie_facility(), dec_ie_progress(), misdn_bchannel::fac_in, HEADER_LEN, mISDNUSER_HEAD_SIZE, misdn_party_id::number, misdn_party_id::number_plan, misdn_party_id::number_type, misdn_party_id::presentation, misdn_bchannel::progress_coding, misdn_bchannel::progress_indicator, misdn_bchannel::progress_location, misdn_party_id::screening, and type.

00617 {
00618    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00619    CONNECT_t *connect = (CONNECT_t *) (msg->data + HEADER_LEN);
00620    int type;
00621    int plan;
00622    int pres;
00623    int screen;
00624 
00625    bc->ces = connect->ces;
00626 
00627    dec_ie_progress(connect->PROGRESS, (Q931_info_t *)connect, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00628 
00629    dec_ie_connected_pn(connect->CONNECT_PN, (Q931_info_t *) connect, &type, &plan,
00630       &pres, &screen, bc->connected.number, sizeof(bc->connected.number), nt, bc);
00631    bc->connected.number_type = type;
00632    bc->connected.number_plan = plan;
00633    switch (pres) {
00634    default:
00635    case 0:
00636       bc->connected.presentation = 0;  /* presentation allowed */
00637       break;
00638    case 1:
00639       bc->connected.presentation = 1;  /* presentation restricted */
00640       break;
00641    case 2:
00642       bc->connected.presentation = 2;  /* Number not available */
00643       break;
00644    }
00645    if (0 <= screen) {
00646       bc->connected.screening = screen;
00647    } else {
00648       bc->connected.screening = 0;  /* Unscreened */
00649    }
00650 
00651    dec_ie_facility(connect->FACILITY, (Q931_info_t *) connect, &bc->fac_in, nt, bc);
00652 
00653    /*
00654       cb_log(1,bc->port,"CONNETED PN: %s cpn_dialplan:%d\n", connected_pn, type);
00655    */
00656 
00657 #ifdef DEBUG
00658    printf("Parsing CONNECT Msg\n");
00659 #endif
00660 }

static void parse_connect_acknowledge ( 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 CONNECT_ACKNOWLEDGE Msg\n");
00760 #endif
00761 
00762 
00763 }

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

Definition at line 1081 of file isdn_msg_parser.c.

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

01082 {
01083    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01084    DISCONNECT_t *disconnect = (DISCONNECT_t *) (msg->data + HEADER_LEN);
01085    int location;
01086    int cause;
01087    dec_ie_cause(disconnect->CAUSE, (Q931_info_t *)(disconnect), &location, &cause, nt,bc);
01088    if (cause>0) bc->cause=cause;
01089 
01090    dec_ie_facility(disconnect->FACILITY, (Q931_info_t *) disconnect, &bc->fac_in, nt, bc);
01091 
01092    dec_ie_progress(disconnect->PROGRESS, (Q931_info_t *)disconnect, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
01093 #ifdef DEBUG
01094    printf("Parsing DISCONNECT Msg\n");
01095 #endif
01096 
01097 
01098 }

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

Definition at line 1279 of file isdn_msg_parser.c.

References cb_log, dec_ie_notify(), dec_ie_redir_dn(), misdn_bchannel::fac_in, HEADER_LEN, mISDN_NOTIFY_CODE_INVALID, mISDNUSER_HEAD_SIZE, misdn_bchannel::notify_description_code, misdn_bchannel::nt, misdn_party_id::number, misdn_party_id::number_plan, misdn_party_id::number_type, misdn_bchannel::port, misdn_party_id::presentation, misdn_bchannel::redirecting, misdn_party_id::screening, misdn_party_redirecting::to, misdn_party_redirecting::to_changed, and type.

01280 {
01281    int HEADER_LEN = nt ? mISDNUSER_HEAD_SIZE : mISDN_HEADER_LEN;
01282    FACILITY_t *facility = (FACILITY_t*)(msg->data+HEADER_LEN);
01283    Q931_info_t *qi = (Q931_info_t*)(msg->data+HEADER_LEN);
01284    unsigned char *p = NULL;
01285 #if defined(AST_MISDN_ENHANCEMENTS)
01286    int description_code;
01287    int type;
01288    int plan;
01289    int present;
01290    char number[sizeof(bc->redirecting.to.number)];
01291 #endif   /* defined(AST_MISDN_ENHANCEMENTS) */
01292 
01293 #ifdef DEBUG
01294    printf("Parsing FACILITY Msg\n");
01295 #endif
01296 
01297    bc->fac_in.Function = Fac_None;
01298 
01299    if (!bc->nt) {
01300       if (qi->QI_ELEMENT(facility))
01301          p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(facility) + 1;
01302    } else {
01303       p = facility->FACILITY;
01304    }
01305    if (!p)
01306       return;
01307 
01308    if (decodeFac(p, &bc->fac_in)) {
01309       cb_log(3, bc->port, "Decoding facility ie failed! Unrecognized facility message?\n");
01310    }
01311 
01312 #if defined(AST_MISDN_ENHANCEMENTS)
01313    dec_ie_notify(facility->NOTIFY, qi, &description_code, nt, bc);
01314    if (description_code < 0) {
01315       bc->notify_description_code = mISDN_NOTIFY_CODE_INVALID;
01316    } else {
01317       bc->notify_description_code = description_code;
01318    }
01319 
01320    dec_ie_redir_dn(facility->REDIR_DN, qi, &type, &plan, &present, number, sizeof(number), nt, bc);
01321    if (0 <= type) {
01322       bc->redirecting.to_changed = 1;
01323 
01324       bc->redirecting.to.number_type = type;
01325       bc->redirecting.to.number_plan = plan;
01326       switch (present) {
01327       default:
01328       case 0:
01329          bc->redirecting.to.presentation = 0;   /* presentation allowed */
01330          break;
01331       case 1:
01332          bc->redirecting.to.presentation = 1;   /* presentation restricted */
01333          break;
01334       case 2:
01335          bc->redirecting.to.presentation = 2;   /* Number not available */
01336          break;
01337       }
01338       bc->redirecting.to.screening = 0;   /* Unscreened */
01339       strcpy(bc->redirecting.to.number, number);
01340    }
01341 #endif   /* defined(AST_MISDN_ENHANCEMENTS) */
01342 }

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

Definition at line 850 of file isdn_msg_parser.c.

00851 {
00852 #ifdef DEBUG
00853    printf("Parsing HOLD Msg\n");
00854 #endif
00855 
00856 
00857 }

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

Definition at line 919 of file isdn_msg_parser.c.

00920 {
00921 #ifdef DEBUG
00922    printf("Parsing HOLD_ACKNOWLEDGE Msg\n");
00923 #endif
00924 
00925 
00926 }

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

Definition at line 988 of file isdn_msg_parser.c.

00989 {
00990 #ifdef DEBUG
00991    printf("Parsing HOLD_REJECT Msg\n");
00992 #endif
00993 
00994 
00995 }

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

Definition at line 1576 of file isdn_msg_parser.c.

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

01577 {
01578    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01579    INFORMATION_t *information = (INFORMATION_t *) (msg->data + HEADER_LEN);
01580    int type, plan;
01581 
01582    dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *) information, &type, &plan, bc->info_dad, sizeof(bc->info_dad), nt, bc);
01583    dec_ie_keypad(information->KEYPAD, (Q931_info_t *) information, bc->keypad, sizeof(bc->keypad), nt, bc);
01584 
01585 #ifdef DEBUG
01586    printf("Parsing INFORMATION Msg\n");
01587 #endif
01588 }

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

Definition at line 1480 of file isdn_msg_parser.c.

References dec_ie_notify(), dec_ie_redir_dn(), mISDN_NOTIFY_CODE_INVALID, mISDNUSER_HEAD_SIZE, misdn_bchannel::notify_description_code, misdn_party_id::number, misdn_party_id::number_plan, misdn_party_id::number_type, misdn_party_id::presentation, misdn_bchannel::redirecting, misdn_party_id::screening, misdn_party_redirecting::to, misdn_party_redirecting::to_changed, and type.

01481 {
01482    int HEADER_LEN = nt ? mISDNUSER_HEAD_SIZE : mISDN_HEADER_LEN;
01483    NOTIFY_t *notify = (NOTIFY_t *) (msg->data + HEADER_LEN);
01484    int description_code;
01485    int type;
01486    int plan;
01487    int present;
01488    char number[sizeof(bc->redirecting.to.number)];
01489 
01490 #ifdef DEBUG
01491    printf("Parsing NOTIFY Msg\n");
01492 #endif
01493 
01494    dec_ie_notify(notify->NOTIFY, (Q931_info_t *) notify, &description_code, nt, bc);
01495    if (description_code < 0) {
01496       bc->notify_description_code = mISDN_NOTIFY_CODE_INVALID;
01497    } else {
01498       bc->notify_description_code = description_code;
01499    }
01500 
01501    dec_ie_redir_dn(notify->REDIR_DN, (Q931_info_t *) notify, &type, &plan, &present, number, sizeof(number), nt, bc);
01502    if (0 <= type) {
01503       bc->redirecting.to_changed = 1;
01504 
01505       bc->redirecting.to.number_type = type;
01506       bc->redirecting.to.number_plan = plan;
01507       switch (present) {
01508       default:
01509       case 0:
01510          bc->redirecting.to.presentation = 0;   /* presentation allowed */
01511          break;
01512       case 1:
01513          bc->redirecting.to.presentation = 1;   /* presentation restricted */
01514          break;
01515       case 2:
01516          bc->redirecting.to.presentation = 2;   /* Number not available */
01517          break;
01518       }
01519       bc->redirecting.to.screening = 0;   /* Unscreened */
01520       strcpy(bc->redirecting.to.number, number);
01521    }
01522 }

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

Definition at line 167 of file isdn_msg_parser.c.

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

00168 {
00169    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00170    CALL_PROCEEDING_t *proceeding = (CALL_PROCEEDING_t *) (msg->data + HEADER_LEN);
00171    //struct misdn_stack *stack=get_stack_by_bc(bc);
00172 
00173    {
00174       int  exclusive, channel;
00175       dec_ie_channel_id(proceeding->CHANNEL_ID, (Q931_info_t *)proceeding, &exclusive, &channel, nt,bc);
00176 
00177       set_channel(bc,channel);
00178 
00179    }
00180 
00181    dec_ie_progress(proceeding->PROGRESS, (Q931_info_t *)proceeding, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00182 
00183    dec_ie_facility(proceeding->FACILITY, (Q931_info_t *) proceeding, &bc->fac_in, nt, bc);
00184 
00185    /* dec_ie_redir_dn */
00186 
00187 #ifdef DEBUG
00188    printf("Parsing PROCEEDING Msg\n");
00189 #endif
00190 }

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

Definition at line 261 of file isdn_msg_parser.c.

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

00262 {
00263    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00264    PROGRESS_t *progress = (PROGRESS_t *) (msg->data + HEADER_LEN);
00265    //Q931_info_t *qi=(Q931_info_t*)(msg->data+HEADER_LEN);
00266 
00267    dec_ie_progress(progress->PROGRESS, (Q931_info_t *)progress, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00268 
00269    dec_ie_facility(progress->FACILITY, (Q931_info_t *) progress, &bc->fac_in, nt, bc);
00270 
00271 #ifdef DEBUG
00272    printf("Parsing PROGRESS Msg\n");
00273 #endif
00274 }

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

Definition at line 1171 of file isdn_msg_parser.c.

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

01172 {
01173    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01174    RELEASE_t *release = (RELEASE_t *) (msg->data + HEADER_LEN);
01175    int location;
01176    int cause;
01177 
01178    dec_ie_cause(release->CAUSE, (Q931_info_t *)(release), &location, &cause, nt,bc);
01179    if (cause>0) bc->cause=cause;
01180 
01181    dec_ie_facility(release->FACILITY, (Q931_info_t *) release, &bc->fac_in, nt, bc);
01182 
01183 #ifdef DEBUG
01184    printf("Parsing RELEASE Msg\n");
01185 #endif
01186 
01187 
01188 }

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

Definition at line 1217 of file isdn_msg_parser.c.

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

01218 {
01219    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01220    RELEASE_COMPLETE_t *release_complete = (RELEASE_COMPLETE_t *) (msg->data + HEADER_LEN);
01221    int location;
01222    int cause;
01223    iframe_t *frm = (iframe_t*) msg->data;
01224 
01225    struct misdn_stack *stack=get_stack_by_bc(bc);
01226    mISDNuser_head_t *hh;
01227    hh=(mISDNuser_head_t*)msg->data;
01228 
01229    /*hh=(mISDN_head_t*)msg->data;
01230    mISDN_head_t *hh;*/
01231 
01232    if (nt) {
01233       if (hh->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
01234          cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [NT] \n");
01235          return;
01236       }
01237    } else {
01238       if (frm->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
01239          cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [TE] \n");
01240          return;
01241       }
01242    }
01243    dec_ie_cause(release_complete->CAUSE, (Q931_info_t *)(release_complete), &location, &cause, nt,bc);
01244    if (cause>0) bc->cause=cause;
01245 
01246    dec_ie_facility(release_complete->FACILITY, (Q931_info_t *) release_complete, &bc->fac_in, nt, bc);
01247 
01248 #ifdef DEBUG
01249    printf("Parsing RELEASE_COMPLETE Msg\n");
01250 #endif
01251 }

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

Definition at line 1129 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.

01130 {
01131    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01132    RESTART_t *restart = (RESTART_t *) (msg->data + HEADER_LEN);
01133 
01134    struct misdn_stack *stack=get_stack_by_bc(bc);
01135 
01136 #ifdef DEBUG
01137    printf("Parsing RESTART Msg\n");
01138 #endif
01139 
01140    {
01141       int  exclusive;
01142       dec_ie_channel_id(restart->CHANNEL_ID, (Q931_info_t *)restart, &exclusive, &bc->restart_channel, nt,bc);
01143       cb_log(3, stack->port, "CC_RESTART Request on channel:%d on this port.\n", bc->restart_channel);
01144    }
01145 
01146 }

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

Definition at line 896 of file isdn_msg_parser.c.

00897 {
00898 #ifdef DEBUG
00899    printf("Parsing RESUME Msg\n");
00900 #endif
00901 
00902 
00903 }

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

Definition at line 965 of file isdn_msg_parser.c.

00966 {
00967 #ifdef DEBUG
00968    printf("Parsing RESUME_ACKNOWLEDGE Msg\n");
00969 #endif
00970 
00971 
00972 }

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

Definition at line 827 of file isdn_msg_parser.c.

00828 {
00829 #ifdef DEBUG
00830    printf("Parsing RESUME_REJECT Msg\n");
00831 #endif
00832 
00833 
00834 }

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

Definition at line 1011 of file isdn_msg_parser.c.

01012 {
01013 #ifdef DEBUG
01014    printf("Parsing RETRIEVE Msg\n");
01015 #endif
01016 
01017 
01018 }

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

Definition at line 1034 of file isdn_msg_parser.c.

01035 {
01036 #ifdef DEBUG
01037    printf("Parsing RETRIEVE_ACKNOWLEDGE Msg\n");
01038 #endif
01039 
01040 
01041 }

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

Definition at line 1058 of file isdn_msg_parser.c.

01059 {
01060 #ifdef DEBUG
01061    printf("Parsing RETRIEVE_REJECT Msg\n");
01062 #endif
01063 
01064 
01065 }

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

Definition at line 365 of file isdn_msg_parser.c.

References misdn_bchannel::caller, misdn_bchannel::capability, capability, cb_log, dec_ie_bearer(), dec_ie_called_pn(), dec_ie_calling_pn(), dec_ie_channel_id(), dec_ie_complete(), dec_ie_facility(), dec_ie_keypad(), dec_ie_progress(), dec_ie_redir_nr(), dec_ie_useruser(), misdn_bchannel::dialed, misdn_bchannel::fac_in, misdn_party_redirecting::from, 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, mISDN_REDIRECTING_REASON_UNKNOWN, mISDNUSER_HEAD_SIZE, misdn_bchannel::mode, misdn_party_dialing::number, misdn_party_id::number, misdn_party_dialing::number_plan, misdn_party_id::number_plan, misdn_party_dialing::number_type, misdn_party_id::number_type, misdn_bchannel::port, misdn_party_id::presentation, misdn_bchannel::progress_coding, misdn_bchannel::progress_indicator, misdn_bchannel::progress_location, misdn_bchannel::rate, misdn_party_redirecting::reason, misdn_bchannel::redirecting, misdn_party_id::screening, misdn_bchannel::sending_complete, set_channel(), type, misdn_bchannel::urate, misdn_bchannel::user1, misdn_bchannel::uu, and misdn_bchannel::uulen.

00366 {
00367    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00368    SETUP_t *setup = (SETUP_t *) (msg->data + HEADER_LEN);
00369    Q931_info_t *qi = (Q931_info_t *) (msg->data + HEADER_LEN);
00370    int type;
00371    int plan;
00372    int present;
00373    int screen;
00374    int reason;
00375 
00376 #ifdef DEBUG
00377    printf("Parsing SETUP Msg\n");
00378 #endif
00379 
00380    dec_ie_calling_pn(setup->CALLING_PN, qi, &type, &plan, &present, &screen, bc->caller.number, sizeof(bc->caller.number), nt, bc);
00381    bc->caller.number_type = type;
00382    bc->caller.number_plan = plan;
00383    switch (present) {
00384    default:
00385    case 0:
00386       bc->caller.presentation = 0;  /* presentation allowed */
00387       break;
00388    case 1:
00389       bc->caller.presentation = 1;  /* presentation restricted */
00390       break;
00391    case 2:
00392       bc->caller.presentation = 2;  /* Number not available */
00393       break;
00394    }
00395    if (0 <= screen) {
00396       bc->caller.screening = screen;
00397    } else {
00398       bc->caller.screening = 0;  /* Unscreened */
00399    }
00400 
00401    dec_ie_facility(setup->FACILITY, (Q931_info_t *) setup, &bc->fac_in, nt, bc);
00402 
00403    dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *) setup, &type, &plan, bc->dialed.number, sizeof(bc->dialed.number), nt, bc);
00404    bc->dialed.number_type = type;
00405    bc->dialed.number_plan = plan;
00406 
00407    dec_ie_keypad(setup->KEYPAD, (Q931_info_t *) setup, bc->keypad, sizeof(bc->keypad), nt, bc);
00408 
00409    dec_ie_complete(setup->COMPLETE, (Q931_info_t *) setup, &bc->sending_complete, nt, bc);
00410 
00411    dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *) setup, &type, &plan, &present, &screen, &reason, bc->redirecting.from.number, sizeof(bc->redirecting.from.number), nt, bc);
00412    bc->redirecting.from.number_type = type;
00413    bc->redirecting.from.number_plan = plan;
00414    switch (present) {
00415    default:
00416    case 0:
00417       bc->redirecting.from.presentation = 0; /* presentation allowed */
00418       break;
00419    case 1:
00420       bc->redirecting.from.presentation = 1; /* presentation restricted */
00421       break;
00422    case 2:
00423       bc->redirecting.from.presentation = 2; /* Number not available */
00424       break;
00425    }
00426    if (0 <= screen) {
00427       bc->redirecting.from.screening = screen;
00428    } else {
00429       bc->redirecting.from.screening = 0; /* Unscreened */
00430    }
00431    if (0 <= reason) {
00432       bc->redirecting.reason = reason;
00433    } else {
00434       bc->redirecting.reason = mISDN_REDIRECTING_REASON_UNKNOWN;
00435    }
00436 
00437    {
00438       int  coding, capability, mode, rate, multi, user, async, urate, stopbits, dbits, parity;
00439 
00440       dec_ie_bearer(setup->BEARER, (Q931_info_t *)setup, &coding, &capability, &mode, &rate, &multi, &user, &async, &urate, &stopbits, &dbits, &parity, nt,bc);
00441       switch (capability) {
00442       case -1: bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
00443          break;
00444       case 0: bc->capability=INFO_CAPABILITY_SPEECH;
00445          break;
00446       case 18: bc->capability=INFO_CAPABILITY_VIDEO;
00447          break;
00448       case 8: bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
00449          bc->user1 = user;
00450          bc->urate = urate;
00451 
00452          bc->rate = rate;
00453          bc->mode = mode;
00454          break;
00455       case 9: bc->capability=INFO_CAPABILITY_DIGITAL_RESTRICTED;
00456          break;
00457       default:
00458          break;
00459       }
00460 
00461       switch(user) {
00462       case 2:
00463          bc->law=INFO_CODEC_ULAW;
00464          break;
00465       case 3:
00466          bc->law=INFO_CODEC_ALAW;
00467          break;
00468       default:
00469          bc->law=INFO_CODEC_ALAW;
00470 
00471       }
00472 
00473       bc->capability=capability;
00474    }
00475    {
00476       int  exclusive, channel;
00477       dec_ie_channel_id(setup->CHANNEL_ID, (Q931_info_t *)setup, &exclusive, &channel, nt,bc);
00478 
00479       set_channel(bc,channel);
00480    }
00481 
00482    {
00483       int  protocol ;
00484       dec_ie_useruser(setup->USER_USER, (Q931_info_t *)setup, &protocol, bc->uu, &bc->uulen, nt,bc);
00485       if (bc->uulen) cb_log(1,bc->port,"USERUESRINFO:%s\n",bc->uu);
00486       else
00487       cb_log(1,bc->port,"NO USERUESRINFO\n");
00488    }
00489 
00490    dec_ie_progress(setup->PROGRESS, (Q931_info_t *)setup, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00491 
00492 #if defined(AST_MISDN_ENHANCEMENTS)
00493    extract_setup_Bc_Hlc_Llc(setup, nt, bc);
00494 #endif   /* defined(AST_MISDN_ENHANCEMENTS) */
00495 }

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

Definition at line 709 of file isdn_msg_parser.c.

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

00710 {
00711    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
00712    SETUP_ACKNOWLEDGE_t *setup_acknowledge = (SETUP_ACKNOWLEDGE_t *) (msg->data + HEADER_LEN);
00713 
00714    {
00715       int  exclusive, channel;
00716       dec_ie_channel_id(setup_acknowledge->CHANNEL_ID, (Q931_info_t *)setup_acknowledge, &exclusive, &channel, nt,bc);
00717 
00718 
00719       set_channel(bc, channel);
00720    }
00721 
00722    dec_ie_progress(setup_acknowledge->PROGRESS, (Q931_info_t *)setup_acknowledge, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
00723 
00724    dec_ie_facility(setup_acknowledge->FACILITY, (Q931_info_t *) setup_acknowledge, &bc->fac_in, nt, bc);
00725 
00726 #ifdef DEBUG
00727    printf("Parsing SETUP_ACKNOWLEDGE Msg\n");
00728 #endif
00729 
00730 
00731 }

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

Definition at line 1615 of file isdn_msg_parser.c.

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

01616 {
01617    int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
01618    STATUS_t *status = (STATUS_t *) (msg->data + HEADER_LEN);
01619    int location;
01620    int cause;
01621 
01622    dec_ie_cause(status->CAUSE, (Q931_info_t *)(status), &location, &cause, nt,bc);
01623    if (cause>0) bc->cause=cause;
01624 
01625 #ifdef DEBUG
01626    printf("Parsing STATUS Msg\n");
01627 #endif
01628 }

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

Definition at line 1555 of file isdn_msg_parser.c.

01556 {
01557 #ifdef DEBUG
01558    printf("Parsing STATUS_ENQUIRY Msg\n");
01559 #endif
01560 }

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

Definition at line 873 of file isdn_msg_parser.c.

00874 {
00875 #ifdef DEBUG
00876    printf("Parsing SUSPEND Msg\n");
00877 #endif
00878 
00879 
00880 }

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

Definition at line 942 of file isdn_msg_parser.c.

00943 {
00944 #ifdef DEBUG
00945    printf("Parsing SUSPEND_ACKNOWLEDGE Msg\n");
00946 #endif
00947 
00948 
00949 }

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

Definition at line 804 of file isdn_msg_parser.c.

00805 {
00806 #ifdef DEBUG
00807    printf("Parsing SUSPEND_REJECT Msg\n");
00808 #endif
00809 
00810 
00811 }

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

Definition at line 1644 of file isdn_msg_parser.c.

01645 {
01646 #ifdef DEBUG
01647    printf("Parsing STATUS Msg\n");
01648 #endif
01649 }

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

Definition at line 781 of file isdn_msg_parser.c.

00782 {
00783 #ifdef DEBUG
00784    printf("Parsing USER_INFORMATION Msg\n");
00785 #endif
00786 
00787 
00788 }

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

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

00140 {
00141 
00142    cb_log(3,bc->port,"set_channel: bc->channel:%d channel:%d\n", bc->channel, channel);
00143 
00144 
00145    if (channel==0xff) {
00146       /* any channel */
00147       channel=-1;
00148    }
00149 
00150    /*  ALERT: is that everytime true ?  */
00151    if (channel > 0 && bc->nt ) {
00152 
00153       if (bc->channel && ( bc->channel != 0xff) ) {
00154          cb_log(0,bc->port,"We already have a channel (%d)\n", bc->channel);
00155       } else {
00156          bc->channel = channel;
00157          cb_event(EVENT_NEW_CHANNEL,bc,NULL);
00158       }
00159    }
00160 
00161    if (channel > 0 && !bc->nt ) {
00162       bc->channel = channel;
00163       cb_event(EVENT_NEW_CHANNEL,bc,NULL);
00164    }
00165 }


Variable Documentation

char EVENT_BCHAN_ACTIVATED_INFO[] = "BCHAN_ACTIVATED"

Definition at line 1770 of file isdn_msg_parser.c.

char EVENT_BCHAN_DATA_INFO[] = "BCHAN_DATA"

Definition at line 1769 of file isdn_msg_parser.c.

char EVENT_BCHAN_ERROR_INFO[] = "BCHAN_ERROR"

Definition at line 1772 of file isdn_msg_parser.c.

char EVENT_CLEAN_INFO[] = "CLEAN_UP"

Definition at line 1763 of file isdn_msg_parser.c.

char EVENT_DTMF_TONE_INFO[] = "DTMF_TONE"

Definition at line 1764 of file isdn_msg_parser.c.

char EVENT_NEW_BC_INFO[] = "NEW_BC"

Definition at line 1766 of file isdn_msg_parser.c.

char EVENT_NEW_CHANNEL_INFO[] = "NEW_CHANNEL"

Definition at line 1768 of file isdn_msg_parser.c.

char EVENT_NEW_L3ID_INFO[] = "NEW_L3ID"

Definition at line 1765 of file isdn_msg_parser.c.

char EVENT_PORT_ALARM_INFO[] = "ALARM"

Definition at line 1767 of file isdn_msg_parser.c.

char EVENT_TONE_GENERATE_INFO[] = "TONE_GENERATE"

Definition at line 1771 of file isdn_msg_parser.c.

struct isdn_msg msgs_g[]


Generated on Sat Mar 26 11:23:33 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.9