static unsigned int parse_sip_options(struct sip_pvt *pvt, const char *supported);
static void parse_request(struct sip_request *req);
static const char *get_header(const struct sip_request *req, const char *name);
-static char *referstatus2str(enum referstatus rstatus) attribute_pure;
+static const char *referstatus2str(enum referstatus rstatus) attribute_pure;
static int method_match(enum sipmethod id, const char *name);
static void parse_copy(struct sip_request *dst, const struct sip_request *src);
static char *get_in_brackets(char *tmp);
};
/*! \brief Convert transfer status to string */
-static char *referstatus2str(enum referstatus rstatus)
+static const char *referstatus2str(enum referstatus rstatus)
{
int i = (sizeof(referstatusstrings) / sizeof(referstatusstrings[0]));
int x;
for (x = 0; x < i; x++) {
if (referstatusstrings[x].status == rstatus)
- return (char *) referstatusstrings[x].text;
+ return referstatusstrings[x].text;
}
return "";
}
referred_by_uri = get_in_brackets(h_referred_by);
if(strncasecmp(referred_by_uri, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a sip: header (Referred-by: %s). Skipping.\n", referred_by_uri);
- referred_by_uri = (char *) NULL;
+ referred_by_uri = NULL;
} else {
referred_by_uri += 4; /* Skip sip: */
}
#define FORMAT "%-15.15s %-10.10s %-11.11s %5.5d/%5.5d %-4.4s %-3.3s %-3.3s %-15.15s %-10.10s\n"
struct sip_pvt *cur;
int numchans = 0;
- char *referstatus = NULL;
if (argc != 3)
return RESULT_SHOWUSAGE;
else
ast_cli(fd, FORMAT3, "Peer", "User", "Call ID", "Extension", "Last state", "Type", "Mailbox");
for (; cur; cur = cur->next) {
- referstatus = "";
- if (cur->refer) { /* SIP transfer in progress */
- referstatus = referstatus2str(cur->refer->status);
- }
+
if (cur->subscribed == NONE && !subscriptions) {
+ /* set if SIP transfer in progress */
+ const char *referstatus = cur->refer ? referstatus2str(cur->refer->status) : "";
+
ast_cli(fd, FORMAT, ast_inet_ntoa(cur->sa.sin_addr),
S_OR(cur->username, S_OR(cur->cid_num, "(None)")),
cur->callid,
ast_log(LOG_DEBUG, "Asked to create a SIP channel with formats: %s\n", ast_getformatname_multiple(tmp, sizeof(tmp), oldformat));
if (!(p = sip_alloc(NULL, NULL, 0, SIP_INVITE))) {
- ast_log(LOG_ERROR, "Unable to build sip pvt data for '%s' (Out of memory or socket error)\n", (char *)data);
+ ast_log(LOG_ERROR, "Unable to build sip pvt data for '%s' (Out of memory or socket error)\n", dest);
*cause = AST_CAUSE_SWITCH_CONGESTION;
return NULL;
}
static int sip_dtmfmode(struct ast_channel *chan, void *data)
{
struct sip_pvt *p;
- char *mode;
- if (data)
- mode = (char *)data;
- else {
+ char *mode = data;
+
+ if (!data) {
ast_log(LOG_WARNING, "This application requires the argument: info, inband, rfc2833\n");
return 0;
}
int no = 0;
int ok = FALSE;
char varbuf[30];
- char *inbuf = (char *) data;
+ char *inbuf = data;
if (ast_strlen_zero(inbuf)) {
ast_log(LOG_WARNING, "This application requires the argument: Header\n");