From: Andreas Eversberg Date: Sun, 20 Feb 2011 09:23:03 +0000 (+0100) Subject: [chan_lcr] Fixed broken communication with chan_lcr X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=commitdiff_plain;h=b8ba879d97268aeaa9e5c8838d27d38da731d971 [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) --- 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(¶m, 0, sizeof(union parameter)); - admin_message_from_lcr(mISDNport->ifport->remote, remote_ref, MESSAGE_NEWREF, ¶m); + /* 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(¶m, 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, ¶m); + admin_message_from_lcr(joinremote->j_remote_id, joinremote->j_remote_ref, MESSAGE_RELEASE, ¶m); 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;