/*! \brief Build contact header - the contact header we send out */
static void build_contact(struct sip_pvt *p)
{
+ char tmp[SIPBUFSIZE];
+ char *user;
+
+ user = ast_uri_encode(p->exten, tmp, sizeof(tmp), 1);
+
/* Construct Contact: header */
if (ourport != STANDARD_SIP_PORT)
- ast_string_field_build(p, our_contact, "<sip:%s%s%s:%d>", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip), ourport);
+ ast_string_field_build(p, our_contact, "<sip:%s%s%s:%d>", user, ast_strlen_zero(user) ? "" : "@", ast_inet_ntoa(p->ourip), ourport);
else
- ast_string_field_build(p, our_contact, "<sip:%s%s%s>", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip));
+ ast_string_field_build(p, our_contact, "<sip:%s%s%s>", user, ast_strlen_zero(user) ? "" : "@", ast_inet_ntoa(p->ourip));
}
/*! \brief Build the Remote Party-ID & From using callingpres options */