#include <sys/socket.h>
#include <sys/un.h>
#include <curses.h>
+#ifdef PACKAGE_VERSION
+#undef PACKAGE_VERSION
+#endif
#include "config.h"
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;
if (!(epoint = new Endpoint(0, 0)))
FATAL("No memory for Endpoint instance\n");
- if (!(epoint->ep_app = apppbx = new DEFAULT_ENDPOINT_APP(epoint, 1))) // outgoing
+ if (!(epoint->ep_app = apppbx = new EndpointAppPBX(epoint, 1))) // outgoing
FATAL("No memory for Endpoint Application instance\n");
apppbx->e_adminid = admin->sockserial;
admin->epointid = epoint->ep_serial;
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 */
if (msg->param.bchannel.type == BCHANNEL_ASSIGN_ACK
|| msg->param.bchannel.type == BCHANNEL_REMOVE_ACK
|| msg->param.bchannel.type == BCHANNEL_RELEASE) {
-#warning TODO: depending on the mode (join / remoteport) forward message
/* no ref, but address */
message_bchannel_from_remote(NULL, msg->param.bchannel.type, msg->param.bchannel.handle);
return(0);
/* 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;
interface = interface_first;
while(interface) {
ifport = interface->ifport;
+ if (!ifport)
+ i++;
while(ifport) {
i++;
ifport = ifport->next;
num = 0;
while(interface) {
ifport = interface->ifport;
+ if (!ifport) {
+ /* message */
+ response->am[num].message = ADMIN_RESPONSE_S_INTERFACE;
+ /* interface */
+ SCPY(response->am[num].u.i.interface_name, interface->name);
+ /* portnum */
+ response->am[num].u.i.portnum = -100; /* indicate: no ifport */
+ /* iftype */
+ response->am[num].u.i.extension = interface->extension;
+ /* block */
+ num++;
+ }
while(ifport) {
/* message */
response->am[num].message = ADMIN_RESPONSE_S_INTERFACE;
/*release endpoint if exists */
if (admin->epointid) {
epoint = find_epoint_id(admin->epointid);
- if (epoint) {
- ((class DEFAULT_ENDPOINT_APP *)epoint->ep_app)->
+ if (epoint && epoint->ep_app_type == EAPP_TYPE_PBX) {
+ ((class EndpointAppPBX *)epoint->ep_app)->
release(RELEASE_ALL, LOCATION_PRIVATE_LOCAL, CAUSE_NORMAL, LOCATION_PRIVATE_LOCAL, CAUSE_NORMAL, 0);
}
}