fixup
[lcr.git] / interface.c
index b8eff05..02e1531 100644 (file)
@@ -990,7 +990,7 @@ static int inter_authenticate(struct interface *interface, char *filename, int l
        SPRINT(interface_error, "Error in %s (line %d): SIP not compiled in.\n", filename, line);
        return(-1);
 #else
-       char *p;
+       char *p, *q;
 
        if (!interface->sip) {
                SPRINT(interface_error, "Error in %s (line %d): This is not a SIP interface.\n", filename, line);
@@ -1007,8 +1007,11 @@ static int inter_authenticate(struct interface *interface, char *filename, int l
                SPRINT(interface_error, "Error in %s (line %d): Missing SIP password.\n", filename, line);
                return(-1);
        }
+       q = get_seperated(p);
        SCPY(interface->sip_auth_user, value);
        SCPY(interface->sip_auth_password, p);
+       if (q[0])
+               SCPY(interface->sip_auth_realm, q);
 
        return(0);
 #endif
@@ -1554,8 +1557,9 @@ struct interface_param interface_param[] = {
        {"register", &inter_register, "<user> <host> [options-interval]",
        "Registers to given SIP registrar.\n"
        "Optionally give SIP timer to send OPTIONS messages to keepalive REGISTER sessions."},
-       {"authenticate", &inter_authenticate, "<user> <password>",
-       "Defines SIP user and password for authentication."},
+       {"authenticate", &inter_authenticate, "<user> <password> [realm]",
+       "Defines SIP user and password for authentication.\n"
+       "If no remote IP was give, we are SIP gateway, so realm must be given also."},
        {"options-interval", &options_interval, "<interval> | 0",
        "Defines SIP timer to send OPTIONS messages to keepalive INVITE sessions."},
        {"asserted-id", &options_asserted_id, "<caller-id>",