Asterisk 1.8

This commit is contained in:
MelwareDE 2010-08-13 21:08:20 +00:00
parent ae92425a79
commit 1782726ccd
3 changed files with 39 additions and 1 deletions

View File

@ -1018,9 +1018,11 @@ int pbxcli_capi_chatinfo(int fd, int argc, char *argv[])
room->number, room->name, room->i->vname,
"?", "?");
} else {
ast_channel_lock(c);
ast_cli(fd, "%3d %-12s%-30s\"%s\" <%s>\n",
room->number, room->name, c->name,
(c->cid.cid_name) ? c->cid.cid_name:"", c->cid.cid_num);
pbx_capi_get_callername (c), pbx_capi_get_cid (c));
ast_channel_unlock(c);
}
room = room->next;
}

View File

@ -1541,3 +1541,37 @@ int capi_write_frame(struct capi_pvt *i, struct ast_frame *f)
return ret;
}
/*
ast_channel_lock(chan) to be held while
while accessing returned pointer
*/
const char* pbx_capi_get_cid (struct ast_channel* c)
{
const char* cid;
#ifdef CC_AST_HAS_VERSION_1_8
cid = S_COR(c->caller.id.number.valid, c->caller.id.number.str, "");
#else
cid = c->cid.cid_num;
#endif
return (cid);
}
/*
ast_channel_lock(chan) to be held while
while accessing returned pointer
*/
const char* pbx_capi_get_callername (struct ast_channel* c)
{
const char* name;
#ifdef CC_AST_HAS_VERSION_1_8
name = S_COR(c->caller.id.name.valid, c->caller.id.name.str, "");
#else
name = (c->cid.cid_name) ? c->cid.cid_name : "";
#endif
return (name);
}

View File

@ -59,6 +59,8 @@ extern int capi_create_reader_writer_pipe(struct capi_pvt *i);
extern struct ast_frame *capi_read_pipeframe(struct capi_pvt *i);
extern int capi_write_frame(struct capi_pvt *i, struct ast_frame *f);
extern int capi_verify_resource_plci(const struct capi_pvt *i);
extern const char* pbx_capi_get_cid (struct ast_channel* c);
extern const char* pbx_capi_get_callername (struct ast_channel* c);
#define capi_number(data, strip) \
capi_number_func(data, strip, alloca(AST_MAX_EXTENSION))