summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0928f45)
Basically sets the callerid and callername to the first device talked to for the
purposes of putting the the calls made log on the device. Does not affect the device
displaying who the device is currently talking to.
Also some minor changes to use sub->exten in lieu of l->lastnumberdialed.
(closes issue ASTERISK-21095)
Reported by: wedhorn
Tested by: snuffy, myself
Patches:
skinny-calllogsoutbound03.diff uploaded by wedhorn (license 5019)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382008
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
int aa_beep;
int aa_mute;
int dialer_sched;
int aa_beep;
int aa_mute;
int dialer_sched;
+ char *origtonum;
+ char *origtoname;
AST_LIST_ENTRY(skinny_subchannel) list;
struct skinny_subchannel *related;
AST_LIST_ENTRY(skinny_subchannel) list;
struct skinny_subchannel *related;
}
//static void transmit_callinfo(struct skinny_subchannel *sub)
}
//static void transmit_callinfo(struct skinny_subchannel *sub)
-static void transmit_callinfo(struct skinny_device *d, int instance, int callid, char *fromname, char *fromnum, char *toname, char *tonum, int calldirection)
+static void transmit_callinfo(struct skinny_device *d, int instance, int callid,
+ char *fromname, char *fromnum, char *toname, char *tonum, int calldirection, char *origtonum, char *origtoname)
{
struct skinny_req *req;
{
struct skinny_req *req;
ast_copy_string(req->data.callinfo.callingParty, fromnum, sizeof(req->data.callinfo.callingParty));
ast_copy_string(req->data.callinfo.calledPartyName, toname, sizeof(req->data.callinfo.calledPartyName));
ast_copy_string(req->data.callinfo.calledParty, tonum, sizeof(req->data.callinfo.calledParty));
ast_copy_string(req->data.callinfo.callingParty, fromnum, sizeof(req->data.callinfo.callingParty));
ast_copy_string(req->data.callinfo.calledPartyName, toname, sizeof(req->data.callinfo.calledPartyName));
ast_copy_string(req->data.callinfo.calledParty, tonum, sizeof(req->data.callinfo.calledParty));
+ if (origtoname) {
+ ast_copy_string(req->data.callinfo.originalCalledPartyName, origtoname, sizeof(req->data.callinfo.originalCalledPartyName));
+ }
+ if (origtonum) {
+ ast_copy_string(req->data.callinfo.originalCalledParty, origtonum, sizeof(req->data.callinfo.originalCalledParty));
+ }
+
req->data.callinfo.instance = htolel(instance);
req->data.callinfo.reference = htolel(callid);
req->data.callinfo.type = htolel(calldirection);
req->data.callinfo.instance = htolel(instance);
req->data.callinfo.reference = htolel(callid);
req->data.callinfo.type = htolel(calldirection);
- SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting CALL_INFO_MESSAGE to %s, to %s(%s) from %s(%s) (dir=%d) on %s(%d)\n",
- d->name, toname, tonum, fromname, fromnum, calldirection, d->name, instance);
+ SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting CALL_INFO_MESSAGE to %s, to %s(%s) from %s(%s), origto %s(%s) (dir=%d) on %s(%d)\n",
+ d->name, toname, tonum, fromname, fromnum, origtoname, origtonum, calldirection, d->name, instance);
transmit_response(d, req);
}
static void transmit_callinfo_variable(struct skinny_device *d, int instance, int callreference,
transmit_response(d, req);
}
static void transmit_callinfo_variable(struct skinny_device *d, int instance, int callreference,
- char *fromname, char *fromnum, char *toname, char *tonum, int calldirection)
+ char *fromname, char *fromnum, char *toname, char *tonum, int calldirection, char *origtonum, char *origtoname)
{
struct skinny_req *req;
char *strptr;
{
struct skinny_req *req;
char *strptr;
thestrings[1] = ""; /* Appears to be origfrom */
if (calldirection == SKINNY_OUTGOING) {
thestrings[2] = tonum;
thestrings[1] = ""; /* Appears to be origfrom */
if (calldirection == SKINNY_OUTGOING) {
thestrings[2] = tonum;
+ thestrings[3] = origtonum;
} else {
thestrings[2] = "";
} else {
thestrings[2] = "";
thestrings[4] = "";
thestrings[5] = "";
thestrings[6] = "";
thestrings[4] = "";
thestrings[5] = "";
thestrings[6] = "";
thestrings[8] = "";
thestrings[9] = fromname;
thestrings[10] = toname;
thestrings[8] = "";
thestrings[9] = fromname;
thestrings[10] = toname;
+ thestrings[11] = origtoname;
thestrings[12] = "";
strptr = req->data.callinfomessagevariable.calldetails;
for(i = 0; i < 13; i++) {
thestrings[12] = "";
strptr = req->data.callinfomessagevariable.calldetails;
for(i = 0; i < 13; i++) {
- ast_copy_string(strptr, thestrings[i], callinfostrleft);
- strptr += strlen(thestrings[i]) + 1;
- callinfostrleft -= strlen(thestrings[i]) + 1;
+ if (thestrings[i]) {
+ ast_copy_string(strptr, thestrings[i], callinfostrleft);
+ strptr += strlen(thestrings[i]) + 1;
+ callinfostrleft -= strlen(thestrings[i]) + 1;
+ } else {
+ ast_copy_string(strptr, "", callinfostrleft);
+ strptr++;
+ callinfostrleft--;
+ }
}
req->len = req->len - (callinfostrleft & ~0x3);
}
req->len = req->len - (callinfostrleft & ~0x3);
- SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting CALL_INFO_MESSAGE_VARIABLE to %s, to %s(%s) from %s(%s) (dir=%d) on %s(%d)\n",
- d->name, toname, tonum, fromname, fromnum, calldirection, d->name, instance);
+ SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting CALL_INFO_MESSAGE_VARIABLE to %s, to %s(%s) from %s(%s), origto %s(%s) (dir=%d) on %s(%d)\n",
+ d->name, toname, tonum, fromname, fromnum, origtoname, origtonum, calldirection, d->name, instance);
transmit_response(d, req);
}
transmit_response(d, req);
}
}
if (d->protocolversion < 17) {
}
if (d->protocolversion < 17) {
- transmit_callinfo(d, l->instance, sub->callid, fromname, fromnum, toname, tonum, sub->calldirection);
+ transmit_callinfo(d, l->instance, sub->callid, fromname, fromnum, toname, tonum, sub->calldirection, sub->origtonum, sub->origtoname);
- transmit_callinfo_variable(d, l->instance, sub->callid, fromname, fromnum, toname, tonum, sub->calldirection);
+ transmit_callinfo_variable(d, l->instance, sub->callid, fromname, fromnum, toname, tonum, sub->calldirection, sub->origtonum, sub->origtoname);
}
if (d->protocolversion < 17) {
}
if (d->protocolversion < 17) {
- transmit_callinfo(subline->line->device, subline->line->instance, subline->callid, fromname, fromnum, toname, tonum, sub->calldirection);
+ transmit_callinfo(subline->line->device, subline->line->instance, subline->callid, fromname, fromnum, toname, tonum, sub->calldirection, sub->origtonum, sub->origtoname);
- transmit_callinfo_variable(subline->line->device, subline->line->instance, subline->callid, fromname, fromnum, toname, tonum, sub->calldirection);
+ transmit_callinfo_variable(subline->line->device, subline->line->instance, subline->callid, fromname, fromnum, toname, tonum, sub->calldirection, sub->origtonum, sub->origtoname);
+ if (sub->calldirection == SKINNY_OUTGOING && !sub->origtonum) {
+ /* Do not set origtonum before here or origtoname won't be set */
+ sub->origtonum = ast_strdup(sub->exten);
+ if (ast_channel_connected(c)->id.name.valid) {
+ sub->origtoname = ast_strdup(ast_channel_connected(c)->id.name.str);
+ }
+ }
+
if (!ast_channel_caller(c)->id.number.valid
|| ast_strlen_zero(ast_channel_caller(c)->id.number.str)
|| !ast_channel_connected(c)->id.number.valid
if (!ast_channel_caller(c)->id.number.valid
|| ast_strlen_zero(ast_channel_caller(c)->id.number.str)
|| !ast_channel_connected(c)->id.number.valid
sub->owner = NULL;
ast_channel_tech_pvt_set(ast, NULL);
destroy_rtp(sub);
sub->owner = NULL;
ast_channel_tech_pvt_set(ast, NULL);
destroy_rtp(sub);
+ ast_free(sub->origtonum);
+ ast_free(sub->origtoname);
ast_mutex_unlock(&sub->lock);
ast_free(sub);
ast_module_unref(ast_module_info->self);
ast_mutex_unlock(&sub->lock);
ast_free(sub);
ast_module_unref(ast_module_info->self);
ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
}
if (sub->substate == SUBSTATE_DIALING || sub->substate == SUBSTATE_RINGOUT) {
ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
}
if (sub->substate == SUBSTATE_DIALING || sub->substate == SUBSTATE_RINGOUT) {
- transmit_dialednumber(d, l->lastnumberdialed, l->instance, sub->callid);
+ transmit_dialednumber(d, sub->exten, l->instance, sub->callid);
}
if (ast_channel_state(sub->owner) != AST_STATE_UP) {
ast_setstate(sub->owner, AST_STATE_UP);
}
if (ast_channel_state(sub->owner) != AST_STATE_UP) {
ast_setstate(sub->owner, AST_STATE_UP);
transmit_start_tone(d, SKINNY_ALERT, l->instance, sub->callid);
}
transmit_callstate(d, l->instance, sub->callid, SKINNY_RINGOUT);
transmit_start_tone(d, SKINNY_ALERT, l->instance, sub->callid);
}
transmit_callstate(d, l->instance, sub->callid, SKINNY_RINGOUT);
- transmit_dialednumber(d, l->lastnumberdialed, l->instance, sub->callid);
+ transmit_dialednumber(d, sub->exten, l->instance, sub->callid);
send_displaypromptstatus(d, OCTAL_RINGOUT, "", 0, l->instance, sub->callid);
send_callinfo(sub);
sub->substate = SUBSTATE_RINGOUT;
send_displaypromptstatus(d, OCTAL_RINGOUT, "", 0, l->instance, sub->callid);
send_callinfo(sub);
sub->substate = SUBSTATE_RINGOUT;
ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
}
if (sub->substate == SUBSTATE_DIALING || sub->substate == SUBSTATE_RINGOUT) {
ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
}
if (sub->substate == SUBSTATE_DIALING || sub->substate == SUBSTATE_RINGOUT) {
- transmit_dialednumber(d, l->lastnumberdialed, l->instance, sub->callid);
+ transmit_dialednumber(d, sub->exten, l->instance, sub->callid);
}
if (ast_channel_state(sub->owner) != AST_STATE_UP) {
ast_setstate(sub->owner, AST_STATE_UP);
}
if (ast_channel_state(sub->owner) != AST_STATE_UP) {
ast_setstate(sub->owner, AST_STATE_UP);