minor fix to message routing
This commit is contained in:
parent
fcad678f3c
commit
9748e88621
|
@ -504,17 +504,21 @@ MmscGrp *get_handler_mmc(Octstr *id, Octstr *to, Octstr *from)
|
||||||
|
|
||||||
/* handle message routing. */
|
/* handle message routing. */
|
||||||
Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
|
Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
|
||||||
Octstr **mmc_id) {
|
Octstr **mmc_id)
|
||||||
|
{
|
||||||
|
|
||||||
if (m->reroute) {
|
if (m->reroute) {
|
||||||
*mmc_id = m->reroute_mmsc_id ? octstr_duplicate(m->reroute_mmsc_id) : NULL;
|
*mmc_id = m->reroute_mmsc_id ? octstr_duplicate(m->reroute_mmsc_id) : NULL;
|
||||||
return outgoing_qdir;
|
return outgoing_qdir;
|
||||||
} else {
|
} else {
|
||||||
Octstr *_mcid, *qdir = NULL;
|
Octstr *_mcid, *qdir = NULL;
|
||||||
|
Octstr *fto;
|
||||||
|
|
||||||
if (gwlist_len(to) > 0) { /* we route based on first recipient XXX */
|
if (gwlist_len(to) > 0 &&
|
||||||
Octstr *fto = gwlist_extract_first(to);
|
(fto = gwlist_extract_first(to)) != NULL) { /* we route based on first recipient XXX */
|
||||||
|
Octstr *xto = octstr_duplicate(fto);
|
||||||
Octstr *xfrom = octstr_duplicate(from);
|
Octstr *xfrom = octstr_duplicate(from);
|
||||||
|
|
||||||
|
|
||||||
if (unified_prefix)
|
if (unified_prefix)
|
||||||
_mms_fixup_address(&xfrom, octstr_get_cstr(unified_prefix), 0);
|
_mms_fixup_address(&xfrom, octstr_get_cstr(unified_prefix), 0);
|
||||||
|
@ -523,10 +527,17 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
|
||||||
|
|
||||||
_mcid = rfs->mmsbox_resolve(xfrom,fto,octstr_get_cstr(m->id), rfs_data, rfs_settings);
|
_mcid = rfs->mmsbox_resolve(xfrom,fto,octstr_get_cstr(m->id), rfs_data, rfs_settings);
|
||||||
|
|
||||||
if (unified_prefix)
|
/* modify what was sent to us. */
|
||||||
_mms_fixup_address(&fto, octstr_get_cstr(unified_prefix), 1);
|
if (octstr_len(_mcid) == 0) { /* put recipient back, unmodified if incoming only. */
|
||||||
if (fto)
|
gwlist_insert(to, 0, xto);
|
||||||
gwlist_insert(to, 0, fto); /* put it back, after modification. */
|
octstr_destroy(fto);
|
||||||
|
} else {
|
||||||
|
if (unified_prefix)
|
||||||
|
_mms_fixup_address(&fto, octstr_get_cstr(unified_prefix), 1);
|
||||||
|
gwlist_insert(to, 0, fto);
|
||||||
|
octstr_destroy(xto);
|
||||||
|
}
|
||||||
|
|
||||||
if (xfrom) {
|
if (xfrom) {
|
||||||
octstr_delete(from, 0, octstr_len(from));
|
octstr_delete(from, 0, octstr_len(from));
|
||||||
octstr_append(from, xfrom);
|
octstr_append(from, xfrom);
|
||||||
|
@ -535,7 +546,7 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
|
||||||
} else
|
} else
|
||||||
_mcid = NULL;
|
_mcid = NULL;
|
||||||
|
|
||||||
if (_mcid == NULL || octstr_len(_mcid) == 0) {
|
if (octstr_len(_mcid) == 0) {
|
||||||
*mmc_id = NULL;
|
*mmc_id = NULL;
|
||||||
qdir = incoming_qdir;
|
qdir = incoming_qdir;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue