struct sockaddr_in addr; /* Who we connect to for registration purposes */
char username[80];
char secret[80]; /* Password or key name in []'s */
+ char contact[80]; /* Contact extension */
char random[80];
int expire; /* Sched ID of expiration */
int timeout; /* sched id of sip_reg_timeout */
char copy[256] = "";
char *username, *hostname, *secret;
char *porta;
+ char *contact;
char *stringp=NULL;
struct hostent *hp;
stringp=username;
username = strsep(&stringp, ":");
secret = strsep(&stringp, ":");
+ stringp = hostname;
+ hostname = strsep(&stringp, "/");
+ contact = strsep(&stringp, "/");
+ if (!contact || !strlen(contact))
+ contact = "s";
stringp=hostname;
hostname = strsep(&stringp, ":");
- porta = strsep(&stringp, ";");
+ porta = strsep(&stringp, ":");
if (porta && !atoi(porta)) {
ast_log(LOG_WARNING, "%s is not a valid port number at line %d\n", porta, lineno);
reg = malloc(sizeof(struct sip_registry));
if (reg) {
memset(reg, 0, sizeof(struct sip_registry));
+ strncpy(reg->contact, contact, sizeof(reg->contact) - 1);
strncpy(reg->username, username, sizeof(reg->username)-1);
if (secret)
strncpy(reg->secret, secret, sizeof(reg->secret)-1);
add_header(&req, "To", to);
{
char contact[256];
- snprintf(contact, sizeof(contact), "<sip:s@%s:%d;transport=udp>", inet_ntoa(p->ourip), ourport);
+ snprintf(contact, sizeof(contact), "<sip:%s@%s:%d;transport=udp>", r->contact, inet_ntoa(p->ourip), ourport);
add_header(&req, "Contact", contact);
}
add_header(&req, "Call-ID", p->callid);