Added layer1 hold feature. Requires new mISDN and mISDNuser package from git.
[lcr.git] / apppbx.cpp
index 6304848..88694e0 100644 (file)
@@ -128,7 +128,7 @@ EndpointAppPBX::~EndpointAppPBX(void)
 /*
  * trace header for application
  */
-void EndpointAppPBX::trace_header(char *name, int direction)
+void EndpointAppPBX::trace_header(const char *name, int direction)
 {
        struct trace _trace;
 
@@ -327,12 +327,12 @@ void apply_callerid_restriction(struct extension *ext, char *id, int *ntype, int
 }
 
 /* used display message to display callerid as available */
-char *EndpointAppPBX::apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *extension, char *name)
+char *EndpointAppPBX::apply_callerid_display(const char *id, int itype, int ntype, int present, int screen, const char *extension, const char *name)
 {
        static char display[81];
 
        display[0] = '\0';
-       char *cid = numberrize_callerinfo(id, ntype, options.national, options.international);
+       const char *cid = numberrize_callerinfo(id, ntype, options.national, options.international);
 
        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) id='%s' itype=%d ntype=%d present=%d screen=%d extension='%s' name='%s'\n", ea_endpoint->ep_serial, (id)?id:"NULL", itype, ntype, present, screen, (extension)?extension:"NULL", (name)?name:"NULL");
 
@@ -386,7 +386,7 @@ char *EndpointAppPBX::apply_callerid_display(char *id, int itype, int ntype, int
        }
 
        /* display if callerid is anonymouse but available due anon-ignore */
-       if (e_ext.display_fake && screen==INFO_SCREEN_USER && present!=INFO_PRESENT_NULL)
+       if (e_ext.display_fake && screen==INFO_SCREEN_USER && ntype!=INFO_NTYPE_NOTPRESENT)
        {
                if (!display[0])
                {
@@ -528,7 +528,7 @@ void EndpointAppPBX::keypad_function(char digit)
 
 
 /* set tone pattern for port */
-void EndpointAppPBX::set_tone(struct port_list *portlist, char *tone)
+void EndpointAppPBX::set_tone(struct port_list *portlist, const char *tone)
 {
        struct lcr_msg *message;
 
@@ -672,7 +672,7 @@ foundif:
        }
 
        /* see if link is up on PTP*/
-       if (mISDNport->l2hold && !mISDNport->l2link)
+       if (mISDNport->l2hold && mISDNport->l2link<1)
        {
                trace_header("CHANNEL SELECTION (port's layer 2 is down, skipping)", DIRECTION_NONE);
                add_trace("port", NULL, "%d", ifport->portnum);
@@ -832,7 +832,7 @@ void EndpointAppPBX::out_setup(void)
        struct lcr_msg          *message;
        int                     anycall = 0;
        int                     cause = CAUSE_RESSOURCEUNAVAIL;
-       char                    *p;
+       const char              *p;
        char                    cfp[64];
        struct mISDNport        *mISDNport;
        char                    portname[32];
@@ -845,6 +845,10 @@ void EndpointAppPBX::out_setup(void)
        struct port_settings    port_settings;
        int                     channel = 0;
        int                     earlyb;
+       int                     mode = B_MODE_TRANSPARENT;
+
+       /* set bchannel mode */
+       mode = e_capainfo.source_mode;
 
        /* create settings for creating port */
        memset(&port_settings, 0, sizeof(port_settings));
@@ -983,7 +987,7 @@ void EndpointAppPBX::out_setup(void)
                        }
                        /* creating INTERNAL port */
                        SPRINT(portname, "%s-%d-out", mISDNport->ifport->interface->name, mISDNport->portnum);
-                       port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force);
+                       port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode);
                        if (!port)
                                FATAL("No memory for DSS1 Port instance\n");
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) got port %s\n", ea_endpoint->ep_serial, port->p_name);
@@ -1019,6 +1023,7 @@ void EndpointAppPBX::out_setup(void)
 //terminal                             SCPY(message->param.setup.to_terminal, e_dialinginfo.id);
                        /* handle restricted caller ids */
                        apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
+                       apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id2, &message->param.setup.callerinfo.ntype2, &message->param.setup.callerinfo.present2, &message->param.setup.callerinfo.screen2, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
                        apply_callerid_restriction(&e_ext, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, 0, message->param.setup.redirinfo.extension, NULL);
                        /* display callerid if desired for extension */
                        SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name));
@@ -1033,11 +1038,18 @@ void EndpointAppPBX::out_setup(void)
                                SCAT(message->param.setup.callerinfo.id, numberrize_callerinfo(e_callerinfo.id,e_callerinfo.ntype, options.national, options.international));
                                message->param.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
                        }
+                       if (message->param.setup.callerinfo.id2[0] && e_ext.clip_prefix[0])
+                       {
+                               SCPY(message->param.setup.callerinfo.id2, e_ext.clip_prefix);
+                               SCAT(message->param.setup.callerinfo.id2, numberrize_callerinfo(e_callerinfo.id2,e_callerinfo.ntype2, options.national, options.international));
+                               message->param.setup.callerinfo.ntype2 = INFO_NTYPE_UNKNOWN;
+                       }
                        /* use internal caller id */
                        if (e_callerinfo.extension[0] && (message->param.setup.callerinfo.present!=INFO_PRESENT_RESTRICTED || e_ext.anon_ignore))
                        {
                                SCPY(message->param.setup.callerinfo.id, e_callerinfo.extension);
                                message->param.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
+                               message->param.setup.callerinfo.ntype2 = INFO_NTYPE_NOTPRESENT;
                        }
                        message_put(message);
                        logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
@@ -1051,6 +1063,7 @@ void EndpointAppPBX::out_setup(void)
                        if (e_ext.anon_ignore && e_callerinfo.id[0])
                        {
                                e_callerinfo.present = INFO_PRESENT_ALLOWED;
+                               e_callerinfo.present2 = INFO_PRESENT_ALLOWED;
                        }
                }
 
@@ -1091,7 +1104,7 @@ void EndpointAppPBX::out_setup(void)
                                {
                                        /* creating EXTERNAL port*/
                                        SPRINT(portname, "%s-%d-out", mISDNport->ifport->interface->name, mISDNport->portnum);
-                                       if (!(port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force)))
+                                       if (!(port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode)))
                                                FATAL("No memory for DSS1 Port instance\n");
                                        earlyb = mISDNport->earlyb;
                                } else
@@ -1131,6 +1144,7 @@ void EndpointAppPBX::out_setup(void)
                                SCPY(message->param.setup.callerinfo.extension, e_ext.number);
                                message->param.setup.callerinfo.ntype = e_ext.callerid_type;
                                message->param.setup.callerinfo.present = e_ext.callerid_present;
+                               message->param.setup.callerinfo.ntype = INFO_NTYPE_NOTPRESENT;
                        }
                        memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
 //terminal                     SCPY(message->param.setup.from_terminal, e_ext.number);
@@ -1138,6 +1152,7 @@ void EndpointAppPBX::out_setup(void)
 //terminal                             SCPY(message->param.setup.to_terminal, e_dialinginfo.id);
                                /* handle restricted caller ids */
                        apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
+                       apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id2, &message->param.setup.callerinfo.ntype2, &message->param.setup.callerinfo.present2, &message->param.setup.callerinfo.screen2, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
                        apply_callerid_restriction(&e_ext, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, 0, message->param.setup.redirinfo.extension, NULL);
                        /* display callerid if desired for extension */
                        SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name));
@@ -1185,7 +1200,7 @@ void EndpointAppPBX::out_setup(void)
                        }
                        /* creating EXTERNAL port*/
                        SPRINT(portname, "%s-%d-out", mISDNport->ifport->interface->name, mISDNport->portnum);
-                       if (!(port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force)))
+                       if (!(port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode)))
                                FATAL("No memory for DSS1 Port instance\n");
                        earlyb = mISDNport->earlyb;
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) created port %s\n", ea_endpoint->ep_serial, port->p_name);
@@ -1213,6 +1228,7 @@ void EndpointAppPBX::out_setup(void)
 //terminal                             SCPY(message->param.setup.to_terminal, e_dialinginfo.id);
                                /* handle restricted caller ids */
                        apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id, &message->param.setup.callerinfo.ntype, &message->param.setup.callerinfo.present, &message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
+                       apply_callerid_restriction(&e_ext, message->param.setup.callerinfo.id2, &message->param.setup.callerinfo.ntype2, &message->param.setup.callerinfo.present2, &message->param.setup.callerinfo.screen2, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name);
                        apply_callerid_restriction(&e_ext, message->param.setup.redirinfo.id, &message->param.setup.redirinfo.ntype, &message->param.setup.redirinfo.present, 0, message->param.setup.redirinfo.extension, NULL);
                        /* display callerid if desired for extension */
                        SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name));
@@ -1489,8 +1505,10 @@ void EndpointAppPBX::port_setup(struct port_list *portlist, int message_type, un
                }
                interface = interface->next;
        }
-       if (interface)
+       if (interface) {
                do_screen(0, e_callerinfo.id, sizeof(e_callerinfo.id), &e_callerinfo.ntype, &e_callerinfo.present, interface);
+               do_screen(0, e_callerinfo.id2, sizeof(e_callerinfo.id2), &e_callerinfo.ntype2, &e_callerinfo.present2, interface);
+       }
 
        /* process extension */
        if (e_callerinfo.itype == INFO_ITYPE_ISDN_EXTENSION)
@@ -1561,6 +1579,7 @@ void EndpointAppPBX::port_setup(struct port_list *portlist, int message_type, un
                        else    e_callerinfo.present = e_ext.callerid_present;
                        e_callerinfo.ntype = e_ext.callerid_type;
                }
+               e_callerinfo.ntype2 = INFO_NTYPE_NOTPRESENT;
 
                /* extension is written */
                if (writeext)
@@ -1633,6 +1652,10 @@ void EndpointAppPBX::port_information(struct port_list *portlist, int message_ty
 {
        logmessage(message_type, param, portlist->port_id, DIRECTION_IN);
 
+       /* ignore information message without digit information */
+       if (!param->information.id[0])
+               return;
+
        e_overlap = 1;
 
        /* turn off dtmf detection, in case dtmf is sent with keypad information */
@@ -1705,7 +1728,8 @@ void EndpointAppPBX::port_information(struct port_list *portlist, int message_ty
        }
        if (e_action)
        if (e_action->index==ACTION_OUTDIAL
-        || e_action->index==ACTION_EXTERNAL)
+        || e_action->index==ACTION_EXTERNAL
+        || e_action->index==ACTION_REMOTE)
        {
                if (!e_extdialing)
                        set_tone(portlist, "dialing");
@@ -1990,7 +2014,7 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
 {
        struct lcr_msg *message;
        char buffer[256];
-       unsigned long port_id = portlist->port_id;
+       unsigned int port_id = portlist->port_id;
        struct port_list *tportlist;
        class Port *port;
        struct interface        *interface;
@@ -2078,7 +2102,7 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
        /* other calls with no caller id (or not available for the extension) and force colp */
        if ((e_connectinfo.id[0]=='\0' || (e_connectinfo.present==INFO_PRESENT_RESTRICTED && !e_ext.anon_ignore))&& e_ext.colp==COLP_FORCE)
        {
-               e_connectinfo.present = INFO_PRESENT_NOTAVAIL;
+               e_connectinfo.ntype = INFO_NTYPE_NOTPRESENT;
                if (portlist->port_type==PORT_TYPE_DSS1_TE_OUT || portlist->port_type==PORT_TYPE_DSS1_NT_OUT) /* external extension answered */
                {
                        port = find_port_id(portlist->port_id);
@@ -2142,6 +2166,7 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
                        e_callerinfo.present = e_ext.callerid_present;
                        e_callerinfo.ntype = e_ext.callerid_type;
                }
+               e_callerinfo.ntype2 = INFO_NTYPE_NOTPRESENT;
 
                e_connectedmode = 1; /* dtmf-hangup & disconnect prevention */
                e_dtmf = 1;
@@ -2200,7 +2225,7 @@ void EndpointAppPBX::port_disconnect_release(struct port_list *portlist, int mes
 {
        struct lcr_msg  *message;
        char            buffer[256];
-       unsigned long   port_id = portlist->port_id;
+       unsigned int    port_id = portlist->port_id;
        int             cause,
                        location;
 
@@ -2413,7 +2438,7 @@ void EndpointAppPBX::port_notify(struct port_list *portlist, int message_type, u
        logmessage(message_type, param, portlist->port_id, DIRECTION_IN);
 
        struct lcr_msg *message;
-       char *logtext = "";
+       const char *logtext = "";
        char buffer[64];
 
        /* signal to call tool */
@@ -2595,10 +2620,9 @@ void EndpointAppPBX::port_resume(struct port_list *portlist, int message_type, u
 
 /* port sends message to the endpoint
  */
-void EndpointAppPBX::ea_message_port(unsigned long port_id, int message_type, union parameter *param)
+void EndpointAppPBX::ea_message_port(unsigned int port_id, int message_type, union parameter *param)
 {
        struct port_list *portlist;
-       struct lcr_msg *message;
 
        portlist = ea_endpoint->ep_portlist;
        while(portlist)
@@ -2788,7 +2812,7 @@ void EndpointAppPBX::ea_message_port(unsigned long port_id, int message_type, un
 
 
                default:
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: %d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, message);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: %d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, message_type);
        }
 
        /* Note: this endpoint may be destroyed, so we MUST return */
@@ -2886,10 +2910,16 @@ void EndpointAppPBX::join_overlap(struct port_list *portlist, int message_type,
                                set_tone(portlist, "dialtone");
                        return;
        }
-       if (e_ext.number[0])
-               set_tone(portlist, "dialpbx");
-       else
-               set_tone(portlist, "dialtone");
+       if (e_dialinginfo.id[0])
+       {
+               set_tone(portlist, "dialing");
+       } else
+       {
+               if (e_ext.number[0])
+                       set_tone(portlist, "dialpbx");
+               else
+                       set_tone(portlist, "dialtone");
+       }
 }
 
 /* join MESSAGE_PROCEEDING */
@@ -3318,7 +3348,7 @@ void EndpointAppPBX::join_notify(struct port_list *portlist, int message_type, u
 
 /* JOIN sends messages to the endpoint
  */
-void EndpointAppPBX::ea_message_join(unsigned long join_id, int message_type, union parameter *param)
+void EndpointAppPBX::ea_message_join(unsigned int join_id, int message_type, union parameter *param)
 {
        struct port_list *portlist;
        struct lcr_msg *message;
@@ -3377,7 +3407,7 @@ void EndpointAppPBX::ea_message_join(unsigned long join_id, int message_type, un
 
                /* JOIN sends OVERLAP message */
                case MESSAGE_OVERLAP:
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received 'more info available'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received 'more info required'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
                if (e_state!=EPOINT_STATE_IN_SETUP
                 && e_state!=EPOINT_STATE_IN_OVERLAP)
                {
@@ -3520,7 +3550,7 @@ void EndpointAppPBX::ea_message_join(unsigned long join_id, int message_type, un
                break;
 
                default:
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: #%d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, message);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received a wrong message: #%d\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, message_type);
        }
 }
 
@@ -3950,7 +3980,7 @@ void EndpointAppPBX::join_join(void)
 /* check if we have an external call
  * this is used to check for encryption ability
  */
-int EndpointAppPBX::check_external(char **errstr, class Port **port)
+int EndpointAppPBX::check_external(const char **errstr, class Port **port)
 {
        struct join_relation *relation;
        class Join *join;
@@ -4052,9 +4082,9 @@ int EndpointAppPBX::check_external(char **errstr, class Port **port)
        return(0);
 }
 
-void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsigned long port_id, int dir)
+void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsigned int port_id, int dir)
 {
-       char *logtext = "unknown";
+       const char *logtext = "unknown";
        char buffer[64];
 
        switch(message_type)
@@ -4079,6 +4109,21 @@ void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsign
                        default:
                        add_trace("caller id", "present", "not available");
                }
+               if (param->setup.callerinfo.ntype2)
+               {
+                       add_trace("caller id2", "number", "%s", numberrize_callerinfo(param->setup.callerinfo.id2, param->setup.callerinfo.ntype2, options.national, options.international));
+                       switch(param->setup.callerinfo.present)
+                       {
+                               case INFO_PRESENT_RESTRICTED:
+                               add_trace("caller id2", "present", "restricted");
+                               break;
+                               case INFO_PRESENT_ALLOWED:
+                               add_trace("caller id2", "present", "allowed");
+                               break;
+                               default:
+                               add_trace("caller id2", "present", "not available");
+                       }
+               }
                if (param->setup.redirinfo.id[0])
                {
                        add_trace("redir'ing", "number", "%s", numberrize_callerinfo(param->setup.redirinfo.id, param->setup.redirinfo.ntype, options.national, options.international));
@@ -4096,6 +4141,10 @@ void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsign
                }
                if (param->setup.dialinginfo.id[0])
                        add_trace("dialing", NULL, "%s", param->setup.dialinginfo.id);
+               if (param->setup.dialinginfo.display[0])
+                       add_trace("display", NULL, "%s", param->setup.dialinginfo.display);
+               if (param->setup.dialinginfo.sending_complete)
+                       add_trace("complete", NULL, "true", param->setup.dialinginfo.sending_complete);
                end_trace();
                break;
 
@@ -4146,6 +4195,8 @@ void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsign
                        default:
                        add_trace("connect id", "present", "not available");
                }
+               if (param->connectinfo.display[0])
+                       add_trace("display", NULL, "%s", param->connectinfo.display);
                end_trace();
                break;
 
@@ -4189,6 +4240,8 @@ void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsign
                        default:
                        add_trace("cause", "location", "%d", param->disconnectinfo.location);
                }
+               if (param->disconnectinfo.display[0])
+                       add_trace("display", NULL, "%s", param->disconnectinfo.display);
                end_trace();
                break;
 
@@ -4305,7 +4358,12 @@ void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsign
                        add_trace("to", NULL, "CH(%lu)", port_id);
                if (dir == DIRECTION_IN)
                        add_trace("from", NULL, "CH(%lu)", port_id);
-               add_trace("dialing", NULL, "%s", param->information.id);
+               if (param->information.id[0])
+                       add_trace("dialing", NULL, "%s", param->information.id);
+               if (param->information.display[0])
+                       add_trace("display", NULL, "%s", param->information.display);
+               if (param->information.sending_complete)
+                       add_trace("complete", NULL, "true", param->information.sending_complete);
                end_trace();
                break;
 
@@ -4380,7 +4438,7 @@ void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsign
        }
 }
 
-void EndpointAppPBX::message_disconnect_port(struct port_list *portlist, int cause, int location, char *display)
+void EndpointAppPBX::message_disconnect_port(struct port_list *portlist, int cause, int location, const char *display)
 {
        struct lcr_msg *message;