From 2debf085354e85b911c3a87a3e63471feddc9f53 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Fri, 20 Mar 2009 18:47:31 +0100 Subject: [PATCH] Added Notify to NT-mode. modified: README modified: dss1.cpp modified: dss1.h modified: mISDN.cpp modified: trace.h --- README | 2 ++ dss1.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++------- dss1.h | 1 + mISDN.cpp | 7 +++---- trace.h | 3 ++- 5 files changed, 50 insertions(+), 12 deletions(-) diff --git a/README b/README index f806638..0013a14 100644 --- a/README +++ b/README @@ -476,3 +476,5 @@ Changes after Version 1.4 release - Added Callweaver support. (thanx to Kristijan) - Bugfix on timeout rules. (thanx to Benjamin) - Fixed dtmf detection of A-D. (thanx to Ralf) +- Fixed Notification messages in NT-mode + -> Notifications like diversions are now sent to terminal. diff --git a/dss1.cpp b/dss1.cpp index 707cfc2..b7ff80c 100644 --- a/dss1.cpp +++ b/dss1.cpp @@ -1685,6 +1685,20 @@ void Pdss1::facility_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) } +/* CC_PROGRESS INDICATION */ +void Pdss1::progress_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) +{ + unsigned char facil[256]; + int facil_len; + struct lcr_msg *message; + int coding, location, progress; + + l1l2l3_trace_header(p_m_mISDNport, this, L3_PROGRESS_IND, DIRECTION_IN); + dec_ie_progress(l3m, &coding, &location, &progress); + end_trace(); +} + + /* * handler for isdn connections * incoming information are parsed and sent via message to the endpoint @@ -1827,6 +1841,10 @@ void Pdss1::message_isdn(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) facility_ind(cmd, pid, l3m); break; + case MT_PROGRESS: + progress_ind(cmd, pid, l3m); + break; + case MT_FREE: l1l2l3_trace_header(p_m_mISDNport, this, L3_RELEASE_L3ID_IND, DIRECTION_IN); add_trace("callref", NULL, "0x%x", p_m_d_l3id); @@ -1859,7 +1877,7 @@ void Pdss1::message_isdn(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) break; default: - l1l2l3_trace_header(p_m_mISDNport, this, L3_UNKNOWN, DIRECTION_IN); + l1l2l3_trace_header(p_m_mISDNport, this, L3_UNKNOWN_IND, DIRECTION_IN); add_trace("unhandled", "cmd", "0x%x", cmd); end_trace(); } @@ -2310,15 +2328,11 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet int notify; int plan = 0, type = -1, present = 0; + printf("if = %d\n", param->notifyinfo.notify); if (param->notifyinfo.notify>INFO_NOTIFY_NONE) notify = param->notifyinfo.notify & 0x7f; else notify = -1; - if (p_state != PORT_STATE_CONNECT) - { - /* notify only allowed in active state */ - notify = -1; - } if (notify >= 0) { plan = 1; @@ -2362,7 +2376,7 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet if (notify >= 0) { - if (p_state!=PORT_STATE_CONNECT) + if (p_state!=PORT_STATE_CONNECT && p_state!=PORT_STATE_IN_PROCEEDING && p_state!=PORT_STATE_IN_ALERTING) { /* queue notification */ if (p_m_d_notify_pending) @@ -2856,6 +2870,13 @@ int Pdss1::message_epoint(unsigned int epoint_id, int message_id, union paramete break; } message_proceeding(epoint_id, message_id, param); + if (p_m_d_notify_pending) + { + /* send pending notify message during connect */ + message_notify(ACTIVE_EPOINT(p_epointlist), p_m_d_notify_pending->type, &p_m_d_notify_pending->param); + message_free(p_m_d_notify_pending); + p_m_d_notify_pending = NULL; + } break; case MESSAGE_ALERTING: /* call of endpoint is ringing */ @@ -2866,6 +2887,13 @@ int Pdss1::message_epoint(unsigned int epoint_id, int message_id, union paramete break; } message_alerting(epoint_id, message_id, param); + if (p_m_d_notify_pending) + { + /* send pending notify message during connect */ + message_notify(ACTIVE_EPOINT(p_epointlist), p_m_d_notify_pending->type, &p_m_d_notify_pending->param); + message_free(p_m_d_notify_pending); + p_m_d_notify_pending = NULL; + } break; case MESSAGE_CONNECT: /* call of endpoint is connected */ @@ -2878,6 +2906,13 @@ int Pdss1::message_epoint(unsigned int epoint_id, int message_id, union paramete break; } message_connect(epoint_id, message_id, param); + if (p_m_d_notify_pending) + { + /* send pending notify message during connect */ + message_notify(ACTIVE_EPOINT(p_epointlist), p_m_d_notify_pending->type, &p_m_d_notify_pending->param); + message_free(p_m_d_notify_pending); + p_m_d_notify_pending = NULL; + } break; case MESSAGE_DISCONNECT: /* call has been disconnected */ diff --git a/dss1.h b/dss1.h index 168a56b..6683a52 100644 --- a/dss1.h +++ b/dss1.h @@ -47,6 +47,7 @@ class Pdss1 : public PmISDN void t312_timeout_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void notify_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void facility_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); + void progress_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void hold_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void retrieve_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); void suspend_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m); diff --git a/mISDN.cpp b/mISDN.cpp index f228906..2f8dd5f 100644 --- a/mISDN.cpp +++ b/mISDN.cpp @@ -221,7 +221,7 @@ static struct isdn_message { {"PH_DEACTIVATE", L1_DEACTIVATE_REQ}, {"DL_ESTABLISH", L2_ESTABLISH_REQ}, {"DL_RELEASE", L2_RELEASE_REQ}, - {"UNKNOWN", L3_UNKNOWN}, + {"UNKNOWN", L3_UNKNOWN_REQ}, {"MT_TIMEOUT", L3_TIMEOUT_REQ}, {"MT_SETUP", L3_SETUP_REQ}, {"MT_SETUP_ACK", L3_SETUP_ACKNOWLEDGE_REQ}, @@ -270,6 +270,7 @@ void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsign i = 0; while(isdn_message[i].name) { +// if (msg == L3_NOTIFY_REQ) printf("val = %x %s\n", isdn_message[i].value, isdn_message[i].name); if (isdn_message[i].value == (msg&0xffffff00)) { SCPY(msgtext, isdn_message[i].name); @@ -1560,11 +1561,9 @@ void PmISDN::set_tone(const char *dir, const char *tone) Port::set_tone(dir, tone); return; } - if (p_tone_dir[0]) - goto nodsp; /* now we USE dsp-tone, convert name */ - else if (!strcmp(tone, "dialtone")) + if (!strcmp(tone, "dialtone")) { switch(options.dsptones) { case DSP_AMERICAN: id = TONE_AMERICAN_DIALTONE; break; diff --git a/trace.h b/trace.h index aeea413..092c2df 100644 --- a/trace.h +++ b/trace.h @@ -97,7 +97,8 @@ #define L3_RELEASE_L3ID_IND 0x0003f102 #define L3_TIMEOUT_REQ 0x0003f200 #define L3_TIMEOUT_IND 0x0003f202 -#define L3_UNKNOWN 0x0003ff00 +#define L3_UNKNOWN_REQ 0x0003ff00 +#define L3_UNKNOWN_IND 0x0003ff02 struct trace_element { -- 2.13.6