This patch is for users who are trying to connect Asterisk to a trunk or gateway that doesn’t allow a caller-id. Normally when you set it blank, it will fill in “asterisk” as the ID.
Some providers or devices don’t allow a user in the From: field at all. In those cases, you will need a quick little patch to allow it to be blank. If a caller-id is specified on the channel, it will get passed through.
--- channels/sip/include/sip.h 2013-01-09 16:30:25.000000000 -0400
+++ channels/sip/include/sip.h 2013-06-26 13:52:03.713476705 -0300
@@ -184,7 +184,7 @@
#define DEFAULT_MOHINTERPRET "default" /*!< The default music class */
#define DEFAULT_MOHSUGGEST ""
#define DEFAULT_VMEXTEN "asterisk" /*!< Default voicemail extension */
-#define DEFAULT_CALLERID "asterisk" /*!< Default caller ID */
+#define DEFAULT_CALLERID "" /*!< Default caller ID */
#define DEFAULT_MWI_FROM ""
#define DEFAULT_NOTIFYMIME "application/simple-message-summary"
#define DEFAULT_ALLOWGUEST TRUE
--- channels/chan_sip.c 2013-06-26 13:45:36.202153235 -0300
+++ channels/chan_sip.c 2013-06-26 13:44:47.912153728 -0300
@@ -12495,9 +12495,9 @@
ourport = (p->fromdomainport) ? p->fromdomainport : ast_sockaddr_port(&p->ourip);
if (!sip_standard_port(p->socket.type, ourport)) {
- snprintf(from, sizeof(from), ""%s" <sip:%s@%s:%d>;tag=%s", n, tmp_l, d, ourport, p->tag);
+ snprintf(from, sizeof(from), ""%s" <sip:%s%s%s:%d>;tag=%s", n, tmp_l, ast_strlen_zero(tmp_l) ? "" : "@", d, ourport, p->tag);
} else {
- snprintf(from, sizeof(from), ""%s" <sip:%s@%s>;tag=%s", n, tmp_l, d, p->tag);
+ snprintf(from, sizeof(from), ""%s" <sip:%s%s%s>;tag=%s", n, tmp_l, ast_strlen_zero(tmp_l) ? "" : "@", d, p->tag);
}
if (!ast_strlen_zero(explicit_uri)) {
