~ubuntu-branches/debian/sid/kamailio/sid

« back to all changes in this revision

Viewing changes to modules/dialog/dialog.c

  • Committer: Package Import Robot
  • Author(s): Victor Seva
  • Date: 2014-01-06 11:47:13 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140106114713-t8xidp4arzrnyeya
Tags: 4.1.1-1
* New upstream release
* debian/patches:
  - add upstream fixes
* Added tls outbound websocket autheph dnssec modules
  - openssl exception added to their license
* removing sparc and ia64 from supported archs
  for mono module (Closes: #728915)

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
str dlg_xavp_cfg = {0};
139
139
int dlg_ka_timer = 0;
140
140
int dlg_ka_interval = 0;
 
141
int dlg_clean_timer = 90;
141
142
 
142
143
/* db stuff */
143
144
static str db_url = str_init(DEFAULT_DB_URL);
147
148
                pv_value_t *res);
148
149
 
149
150
void dlg_ka_timer_exec(unsigned int ticks, void* param);
 
151
void dlg_clean_timer_exec(unsigned int ticks, void* param);
150
152
 
151
153
/* commands wrappers and fixups */
152
154
static int fixup_profile(void** param, int param_no);
453
455
#ifdef STATISTICS
454
456
        /* register statistics */
455
457
        if (register_module_stats( exports.name, mod_stats)!=0 ) {
456
 
                LM_ERR("failed to register core statistics\n");
 
458
                LM_ERR("failed to register %s statistics\n", exports.name);
457
459
                return -1;
458
460
        }
459
461
#endif
697
699
        }
698
700
 
699
701
        destroy_dlg_callbacks( DLGCB_LOADED );
 
702
 
 
703
        /* timer process to send keep alive requests */
700
704
        if(dlg_ka_timer>0 && dlg_ka_interval>0)
701
705
                register_sync_timers(1);
702
706
 
 
707
        /* timer process to clean old unconfirmed dialogs */
 
708
        register_sync_timers(1);
 
709
 
703
710
        return 0;
704
711
}
705
712
 
708
715
{
709
716
        dlg_db_mode = dlg_db_mode_param;
710
717
 
711
 
        if(rank==PROC_MAIN && dlg_ka_timer>0 && dlg_ka_interval>0)
712
 
        {
713
 
                if(fork_sync_timer(PROC_TIMER, "Dialog KA Timer", 1 /*socks flag*/,
714
 
                                dlg_ka_timer_exec, NULL, dlg_ka_timer /*sec*/)<0) {
715
 
                        LM_ERR("failed to start ka timer routine as process\n");
 
718
        if(rank==PROC_MAIN) {
 
719
                if(dlg_ka_timer>0 && dlg_ka_interval>0) {
 
720
                        if(fork_sync_timer(PROC_TIMER, "Dialog KA Timer", 1 /*socks flag*/,
 
721
                                        dlg_ka_timer_exec, NULL, dlg_ka_timer /*sec*/)<0) {
 
722
                                LM_ERR("failed to start ka timer routine as process\n");
 
723
                                return -1; /* error */
 
724
                        }
 
725
                }
 
726
 
 
727
                if(fork_sync_timer(PROC_TIMER, "Dialog Clean Timer", 1 /*socks flag*/,
 
728
                                        dlg_clean_timer_exec, NULL, dlg_clean_timer /*sec*/)<0) {
 
729
                        LM_ERR("failed to start clean timer routine as process\n");
716
730
                        return -1; /* error */
717
731
                }
718
732
        }
1097
1111
                return -1;
1098
1112
        }
1099
1113
 
1100
 
        if(dlg_bridge(&sf, &st, &so)!=0)
 
1114
        if(dlg_bridge(&sf, &st, &so, NULL)!=0)
1101
1115
                return -1;
1102
1116
        return 1;
1103
1117
}
1221
1235
        dlg_ka_run(ticks);
1222
1236
}
1223
1237
 
 
1238
void dlg_clean_timer_exec(unsigned int ticks, void* param)
 
1239
{
 
1240
        dlg_clean_run(ticks);
 
1241
}
 
1242
 
1224
1243
static int fixup_dlg_bye(void** param, int param_no)
1225
1244
{
1226
1245
        char *val;
1345
1364
        str from = {0,0};
1346
1365
        str to = {0,0};
1347
1366
        str op = {0,0};
 
1367
        str bd = {0,0};
1348
1368
        struct mi_node* node;
1349
1369
 
1350
1370
        node = cmd_tree->node.kids;
1374
1394
                {
1375
1395
                        return init_mi_tree(500, "Bad OP value", 12);
1376
1396
                }
 
1397
                if(op.len==1 && *op.s=='.')
 
1398
                {
 
1399
                        op.s = NULL;
 
1400
                        op.len = 0;
 
1401
                }
 
1402
                node= node->next;
 
1403
                if(node != NULL)
 
1404
                {
 
1405
                        bd = node->value;
 
1406
                        if(bd.len<=0 || bd.s==NULL)
 
1407
                        {
 
1408
                                return init_mi_tree(500, "Bad SDP value", 13);
 
1409
                        }
 
1410
                }
1377
1411
        }
1378
1412
 
1379
 
        if(dlg_bridge(&from, &to, &op)!=0)
 
1413
        if(dlg_bridge(&from, &to, &op, &bd)!=0)
1380
1414
                return init_mi_tree(500, MI_INTERNAL_ERR_S,  MI_INTERNAL_ERR_LEN);
1381
1415
 
1382
1416
        return init_mi_tree(200, MI_OK_S, MI_OK_LEN);
1676
1710
        str from = {NULL,0};
1677
1711
        str to = {NULL,0};
1678
1712
        str op = {NULL,0};
 
1713
        str bd = {NULL,0};
1679
1714
        int n;
1680
1715
 
1681
1716
        n = rpc->scan(c, "SS", &from, &to);
1687
1722
        if(rpc->scan(c, "*S", &op)<1) {
1688
1723
                op.s = NULL;
1689
1724
                op.len = 0;
 
1725
        } else {
 
1726
                if(op.len==1 && *op.s=='.') {
 
1727
                        op.s = NULL;
 
1728
                        op.len = 0;
 
1729
                }
 
1730
                if(rpc->scan(c, "*S", &bd)<1) {
 
1731
                        bd.s = NULL;
 
1732
                        bd.len = 0;
 
1733
                }
1690
1734
        }
1691
1735
 
1692
 
        dlg_bridge(&from, &to, &op);
 
1736
        dlg_bridge(&from, &to, &op, &bd);
1693
1737
}
1694
1738
 
1695
1739
static rpc_export_t rpc_methods[] = {