- /* new join */
- if (msg->type == MESSAGE_NEWREF)
- {
- /* create new join instance */
- join = new JoinRemote(0, remote_name, sock_id); // must have no serial, because no endpoint is connected
- if (!join)
- FATAL("No memory for remote join instance\n");
+ /* new join. the reply (NEWREF assignment) is sent from constructor */
+ if (msg->type == MESSAGE_NEWREF) {
+ if (msg->param.newref.mode) {
+ char name[32];
+ /* find remote port */
+ mISDNport = mISDNport_first;
+ while(mISDNport) {
+ if (mISDNport->ifport->remote && !strcmp(mISDNport->ifport->remote_app, admin->remote_name))
+ break;
+ mISDNport = mISDNport->next;
+ }
+ if (!mISDNport) {
+ union parameter 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(¶m, 0, sizeof(union parameter));
+ param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
+ param.disconnectinfo.cause = CAUSE_RESSOURCEUNAVAIL;
+ 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 */
+ SPRINT(name, "%s-%s-in", mISDNport->ifport->interface->name, mISDNport->ifport->remote_app);
+ if (!(remote = new Premote(PORT_TYPE_REMOTE_IN, mISDNport, name, NULL, 0, 0, B_MODE_TRANSPARENT, admin->sock)))
+
+ FATAL("Cannot create Port instance.\n");
+ } else {
+ /* create new join instance */
+ join = 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);
+ }
+ }