summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--apppbx.cpp84
-rw-r--r--apppbx.h1
-rw-r--r--dss1.cpp35
-rw-r--r--lcradmin.c6
-rw-r--r--lcrsocket.h3
-rw-r--r--message.h10
-rw-r--r--socket_server.c4
8 files changed, 139 insertions, 6 deletions
diff --git a/README b/README
index 13fd99c..9eef237 100644
--- a/README
+++ b/README
@@ -544,6 +544,6 @@ Changes after Version 1.7
- Fix by Peter: NULL pointer issue in asterisk frame.
- Fixes a locking bug in chan_lcr. Thanx to WIMPy for that report.
- Fixed forwarding of sending-complete information.
-
+- Added progress messages (receive only).
diff --git a/apppbx.cpp b/apppbx.cpp
index 6836715..cfaf6cb 100644
--- a/apppbx.cpp
+++ b/apppbx.cpp
@@ -2469,6 +2469,25 @@ void EndpointAppPBX::port_notify(struct port_list *portlist, int message_type, u
}
+/* port MESSAGE_PROGRESS */
+void EndpointAppPBX::port_progress(struct port_list *portlist, int message_type, union parameter *param)
+{
+ logmessage(message_type, param, portlist->port_id, DIRECTION_IN);
+
+ struct lcr_msg *message;
+
+ /* signal to call tool */
+ admin_call_response(e_adminid, ADMIN_CALL_PROGRESS, "", 0, param->progressinfo.location, param->progressinfo.progress);
+
+ /* send progress to call if available */
+ if (ea_endpoint->ep_join_id) {
+ message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_join_id, EPOINT_TO_JOIN, MESSAGE_PROGRESS);
+ memcpy(&message->param.progressinfo, &param->progressinfo, sizeof(struct progress_info));
+ message_put(message);
+ }
+
+}
+
/* port MESSAGE_FACILITY */
void EndpointAppPBX::port_facility(struct port_list *portlist, int message_type, union parameter *param)
{
@@ -2665,6 +2684,12 @@ void EndpointAppPBX::ea_message_port(unsigned int port_id, int message_type, uni
port_notify(portlist, message_type, param);
break;
+ /* PORT sends a PROGRESS message */
+ case MESSAGE_PROGRESS:
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received progress.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
+ port_progress(portlist, message_type, param);
+ break;
+
/* PORT sends a SUSPEND message */
case MESSAGE_SUSPEND:
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received suspend.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
@@ -4108,6 +4133,65 @@ void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsign
end_trace();
break;
+ case MESSAGE_PROGRESS:
+ switch(param->progressinfo.progress) {
+ case 0x01:
+ logtext = "Call is not end to end ISDN";
+ break;
+ case 0x02:
+ logtext = "Destination address is non-ISDN";
+ break;
+ case 0x03:
+ logtext = "Origination address is non-ISDN";
+ break;
+ case 0x04:
+ logtext = "Call has returned to the ISDN";
+ break;
+ case 0x08:
+ logtext = "In-band info or pattern available";
+ break;
+ default:
+ SPRINT(buffer, "%d", param->progressinfo.progress);
+ logtext = buffer;
+
+ }
+ trace_header("PROGRESS", dir);
+ if (dir == DIRECTION_OUT)
+ add_trace("to", NULL, "CH(%lu)", port_id);
+ if (dir == DIRECTION_IN)
+ add_trace("from", NULL, "CH(%lu)", port_id);
+ add_trace("indicator", NULL, "%s", logtext);
+ switch(param->progressinfo.location) {
+ case LOCATION_USER:
+ add_trace("cause", "location", "0-User");
+ break;
+ case LOCATION_PRIVATE_LOCAL:
+ add_trace("cause", "location", "1-Local-PBX");
+ break;
+ case LOCATION_PUBLIC_LOCAL:
+ add_trace("cause", "location", "2-Local-Exchange");
+ break;
+ case LOCATION_TRANSIT:
+ add_trace("cause", "location", "3-Transit");
+ break;
+ case LOCATION_PUBLIC_REMOTE:
+ add_trace("cause", "location", "4-Remote-Exchange");
+ break;
+ case LOCATION_PRIVATE_REMOTE:
+ add_trace("cause", "location", "5-Remote-PBX");
+ break;
+ case LOCATION_INTERNATIONAL:
+ add_trace("cause", "location", "7-International-Exchange");
+ break;
+ case LOCATION_BEYOND:
+ add_trace("cause", "location", "10-Beyond-Interworking");
+ break;
+ default:
+ add_trace("cause", "location", "%d", param->progressinfo.location);
+ }
+ end_trace();
+ break;
+
case MESSAGE_INFORMATION:
trace_header("INFORMATION", dir);
if (dir == DIRECTION_OUT)
diff --git a/apppbx.h b/apppbx.h
index 8d2cb07..a2608cc 100644
--- a/apppbx.h
+++ b/apppbx.h
@@ -206,6 +206,7 @@ class EndpointAppPBX : public EndpointApp
void port_disconnect_release(struct port_list *portlist, int message_type, union parameter *param);
void port_timeout(struct port_list *portlist, int message_type, union parameter *param);
void port_notify(struct port_list *portlist, int message_type, union parameter *param);
+ void port_progress(struct port_list *portlist, int message_type, union parameter *param);
void port_facility(struct port_list *portlist, int message_type, union parameter *param);
void port_suspend(struct port_list *portlist, int message_type, union parameter *param);
void port_resume(struct port_list *portlist, int message_type, union parameter *param);
diff --git a/dss1.cpp b/dss1.cpp
index d1430dc..c80a672 100644
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -801,6 +801,13 @@ void Pdss1::setup_acknowledge_ind(unsigned int cmd, unsigned int pid, struct l3_
dec_ie_progress(l3m, &coding, &location, &progress);
end_trace();
+ if (progress >= 0) {
+ message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_PROGRESS);
+ message->param.progressinfo.progress = progress;
+ message->param.progressinfo.location = location;
+ message_put(message);
+ }
+
/* process channel */
ret = received_first_reply_to_setup(cmd, channel, exclusive);
if (ret < 0) {
@@ -850,6 +857,13 @@ void Pdss1::proceeding_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3
dec_ie_redir_dn(l3m, &type, &plan, &present, (unsigned char *)redir, sizeof(redir));
end_trace();
+ if (progress >= 0) {
+ message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_PROGRESS);
+ message->param.progressinfo.progress = progress;
+ message->param.progressinfo.location = location;
+ message_put(message);
+ }
+
ret = received_first_reply_to_setup(cmd, channel, exclusive);
if (ret < 0) {
message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_RELEASE);
@@ -926,6 +940,13 @@ void Pdss1::alerting_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
dec_ie_redir_dn(l3m, &type, &plan, &present, (unsigned char *)redir, sizeof(redir));
end_trace();
+ if (progress >= 0) {
+ message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_PROGRESS);
+ message->param.progressinfo.progress = progress;
+ message->param.progressinfo.location = location;
+ message_put(message);
+ }
+
/* process channel */
ret = received_first_reply_to_setup(cmd, channel, exclusive);
if (ret < 0) {
@@ -1099,6 +1120,13 @@ void Pdss1::disconnect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3
location = LOCATION_PRIVATE_LOCAL;
}
+ if (progress >= 0) {
+ message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_PROGRESS);
+ message->param.progressinfo.progress = progress;
+ message->param.progressinfo.location = proglocation;
+ message_put(message);
+ }
+
/* release if remote sends us no tones */
if (!p_m_mISDNport->earlyb) {
l3_msg *l3m;
@@ -1639,6 +1667,13 @@ void Pdss1::progress_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
l1l2l3_trace_header(p_m_mISDNport, this, L3_PROGRESS_IND, DIRECTION_IN);
dec_ie_progress(l3m, &coding, &location, &progress);
end_trace();
+
+ if (progress >= 0) {
+ message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_PROGRESS);
+ message->param.progressinfo.progress = progress;
+ message->param.progressinfo.location = location;
+ message_put(message);
+ }
}
diff --git a/lcradmin.c b/lcradmin.c
index c7691ee..882105b 100644
--- a/lcradmin.c
+++ b/lcradmin.c
@@ -1579,7 +1579,11 @@ next:
goto next;
case ADMIN_CALL_NOTIFY:
- printf("NOTIFY\n notify=%d\n number=%s\n", msg.u.call.notify, msg.u.call.callerid); fflush(stdout);
+ printf("NOTIFY\n notify=%d\n number=%s\n", msg.u.call.notify_progress, msg.u.call.callerid); fflush(stdout);
+ goto next;
+
+ case ADMIN_CALL_PROGRESS:
+ printf("PROGRESS\n progress=%d\n location=%d\n", msg.u.call.notify_progress, msg.u.call.location); fflush(stdout);
goto next;
case ADMIN_CALL_DISCONNECT:
diff --git a/lcrsocket.h b/lcrsocket.h
index 43543c1..7ecf7ad 100644
--- a/lcrsocket.h
+++ b/lcrsocket.h
@@ -39,6 +39,7 @@ enum { /* messages */
ADMIN_CALL_DISCONNECT,
ADMIN_CALL_RELEASE,
ADMIN_CALL_NOTIFY,
+ ADMIN_CALL_PROGRESS,
ADMIN_TRACE_REQUEST,
ADMIN_TRACE_RESPONSE,
ADMIN_MESSAGE,
@@ -130,7 +131,7 @@ struct admin_call {
int present; /* presentation */
int cause; /* cause to send */
int location;
- int notify;
+ int notify_progress;
int bc_capa;
int bc_mode;
int bc_info1;
diff --git a/message.h b/message.h
index 3c775cc..c23314a 100644
--- a/message.h
+++ b/message.h
@@ -237,6 +237,12 @@ struct notify_info {
int local; /* if set, endpoints gets information about audio channel (open/close) */
};
+/* call-info structure PROGRESS */
+struct progress_info {
+ int progress; /* progress indicator */
+ int location; /* progress location */
+};
+
/* call-info structure FACILITY */
struct facility_info {
char data[256]; /* data info about facility */
@@ -333,6 +339,7 @@ union parameter {
struct connect_info connectinfo; /* CONNECT INFO */
struct disconnect_info disconnectinfo; /* DISCONNECT INFO */
struct notify_info notifyinfo; /* some notifications */
+ struct progress_info progressinfo; /* some progress */
struct facility_info facilityinfo; /* some notifications */
struct park_info parkinfo; /* MESSAGE_SUSPEND, MESSAGE_RESUME */
int state; /* MESSAGE_TIMEOUT */
@@ -383,7 +390,8 @@ enum { /* messages between entities */
MESSAGE_DISCONNECT, /* disconnect with cause */
MESSAGE_RELEASE, /* release with cause */
MESSAGE_TIMEOUT, /* protocol state has timed out (port->epoint) */
- MESSAGE_NOTIFY, /* used to send progress and notify infos */
+ MESSAGE_NOTIFY, /* used to send notify info */
+ MESSAGE_PROGRESS, /* used to send progress info */
MESSAGE_FACILITY, /* used to facility infos, like aocd */
MESSAGE_SUSPEND, /* suspend port */
MESSAGE_RESUME, /* resume port */
diff --git a/socket_server.c b/socket_server.c
index 3083085..70895b0 100644
--- a/socket_server.c
+++ b/socket_server.c
@@ -538,7 +538,7 @@ int admin_call(struct admin_list *admin, struct admin_message *msg)
/*
* this function is called for response whenever a call state changes.
*/
-void admin_call_response(int adminid, int message, const char *connected, int cause, int location, int notify)
+void admin_call_response(int adminid, int message, const char *connected, int cause, int location, int notify_progress)
{
struct admin_list *admin;
struct admin_queue *response, **responsep; /* response pointer */
@@ -573,7 +573,7 @@ void admin_call_response(int adminid, int message, const char *connected, int ca
SCPY(response->am[0].u.call.callerid, connected);
response->am[0].u.call.cause = cause;
response->am[0].u.call.location = location;
- response->am[0].u.call.notify = notify;
+ response->am[0].u.call.notify_progress = notify_progress;
/* attach to response chain */
*responsep = response;