summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg2011-02-20 10:23:03 +0100
committerAndreas Eversberg2011-02-20 10:23:03 +0100
commitb8ba879d97268aeaa9e5c8838d27d38da731d971 (patch)
tree507dd902b1066bc79056c3d44a544af69ba2279c
parent[chan_lcr] Fixed caller ID for calls from AST->LCR (diff)
downloadlcr-b8ba879d97268aeaa9e5c8838d27d38da731d971.tar.gz
lcr-b8ba879d97268aeaa9e5c8838d27d38da731d971.tar.xz
lcr-b8ba879d97268aeaa9e5c8838d27d38da731d971.zip
[chan_lcr] Fixed broken communication with chan_lcr
There are two modes: The remote mode is used to route a call directly to Asterisk or route a call from Asterisk to an ISDN interface. (the old way) The interface mode is used to handle chan_lcr as an interface, so calls from Asterisk can be routed and behave like they come from an ISDN interface. (documentation for that will follow)
-rw-r--r--chan_lcr.c3
-rw-r--r--socket_server.c14
2 files changed, 9 insertions, 8 deletions
diff --git a/chan_lcr.c b/chan_lcr.c
index 2740a32..13aa680 100644
--- a/chan_lcr.c
+++ b/chan_lcr.c
@@ -1522,8 +1522,7 @@ int receive_message(int message_type, unsigned int ref, union parameter *param)
call = find_call_ref(0);
if (!call) {
/* send release, if ref does not exist */
- CDEBUG(NULL, NULL, "No call found, that requests a ref.\n");
- send_release_and_import(call, CAUSE_NORMAL, LOCATION_PRIVATE_LOCAL);
+ CERROR(NULL, NULL, "No call found, that requests a ref.\n");
return 0;
}
/* store new ref */
diff --git a/socket_server.c b/socket_server.c
index 9922dc6..1420268 100644
--- a/socket_server.c
+++ b/socket_server.c
@@ -19,7 +19,6 @@
char socket_name[128];
int sock = -1;
struct sockaddr_un sock_address;
-extern unsigned int new_remote;
struct admin_list *admin_first = NULL;
static struct lcr_fd admin_fd;
@@ -664,15 +663,18 @@ int admin_message_to_lcr(struct admin_msg *msg, struct admin_list *admin)
mISDNport = mISDNport->next;
}
if (!mISDNport) {
- unsigned int remote_ref = new_remote++;
union parameter param;
- memset(&param, 0, sizeof(union parameter));
- admin_message_from_lcr(mISDNport->ifport->remote, remote_ref, MESSAGE_NEWREF, &param);
+ /* create new join instance */
+ join = joinremote = new JoinRemote(0, admin->remote_name, admin->sock); // must have no serial, because no endpoint is connected
+ if (!join) {
+ FATAL("No memory for remote join instance\n");
+ return(-1);
+ }
memset(&param, 0, sizeof(union parameter));
param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
param.disconnectinfo.cause = CAUSE_RESSOURCEUNAVAIL;
- admin_message_from_lcr(mISDNport->ifport->remote, remote_ref, MESSAGE_RELEASE, &param);
+ admin_message_from_lcr(joinremote->j_remote_id, joinremote->j_remote_ref, MESSAGE_RELEASE, &param);
return 0;
}
/* creating port object, transparent until setup with hdlc */
@@ -712,7 +714,7 @@ int admin_message_to_lcr(struct admin_msg *msg, struct admin_list *admin)
/* find join instance */
join = join_first;
while(join) {
- if (join->j_type != JOIN_TYPE_REMOTE) {
+ if (join->j_type == JOIN_TYPE_REMOTE) {
joinremote = (class JoinRemote *)join;
if (joinremote->j_remote_ref == msg->ref)
break;