Index: gwlib/cfg.def =================================================================== --- gwlib/cfg.def (revision 4871) +++ gwlib/cfg.def (working copy) @@ -387,6 +387,7 @@ OCTSTR(status-permfail-regex) OCTSTR(status-tempfail-regex) OCTSTR(max-sms-octets) + OCTSTR(start-at-boot) OCTSTR(login-prompt) OCTSTR(password-prompt) OCTSTR(ssl-client-certkey-file) Index: gw/smscconn_p.h =================================================================== --- gw/smscconn_p.h (revision 4871) +++ gw/smscconn_p.h (working copy) @@ -204,6 +204,7 @@ Dict *reroute_by_receiver; /* reroute receiver numbers to specific smsc-ids */ Octstr *reroute_to_smsc; /* define a smsc-id to reroute to */ int reroute_dlr; /* should DLR's are rereouted too? */ + int start_at_boot; /* should this connection be started at boot time? */ long max_sms_octets; /* max allowed octets for this SMSC */ Index: gw/bearerbox.c =================================================================== --- gw/bearerbox.c (revision 4871) +++ gw/bearerbox.c (working copy) @@ -676,7 +676,7 @@ info(0, "Gateway is now ISOLATED by startup arguments"); gwlist_remove_producer(suspended); } else { - smsc2_resume(); + smsc2_resume(1); gwlist_remove_producer(suspended); gwlist_remove_producer(isolated); } @@ -829,7 +829,7 @@ if (bb_status == BB_SUSPENDED) gwlist_remove_producer(suspended); - smsc2_resume(); + smsc2_resume(0); bb_status = BB_RUNNING; gwlist_remove_producer(isolated); mutex_unlock(status_mutex); Index: gw/bearerbox.h =================================================================== --- gw/bearerbox.h (revision 4871) +++ gw/bearerbox.h (working copy) @@ -152,7 +152,7 @@ int smsc2_restart(Cfg *config); void smsc2_suspend(void); /* suspend (can still send but not receive) */ -void smsc2_resume(void); /* resume */ +void smsc2_resume(int is_init); /* resume */ int smsc2_shutdown(void); void smsc2_cleanup(void); /* final clean-up */ Index: gw/smscconn.c =================================================================== --- gw/smscconn.c (revision 4871) +++ gw/smscconn.c (working copy) @@ -238,10 +238,13 @@ if (cfg_get_integer(&conn->max_sms_octets, grp, octstr_imm("max-sms-octets")) == -1) conn->max_sms_octets = MAX_SMS_OCTETS; + if (cfg_get_bool(&conn->start_at_boot, grp, octstr_imm("start-at-boot")) == -1) + conn->start_at_boot = 1; + /* open a smsc-id specific log-file in exlusive mode */ if (conn->log_file) conn->log_idx = log_open(octstr_get_cstr(conn->log_file), - conn->log_level, GW_EXCL); + conn->log_level, GW_EXCL); #undef GET_OPTIONAL_VAL #undef SPLIT_OPTIONAL_VAL Index: gw/bb_smscconn.c =================================================================== --- gw/bb_smscconn.c (revision 4871) +++ gw/bb_smscconn.c (working copy) @@ -933,7 +933,12 @@ conn = smscconn_create(grp, 1); if (conn != NULL) { gwlist_append(smsc_list, conn); - smscconn_start(conn); + if (conn->start_at_boot) { + smscconn_start(conn); + } else { + /* Shutdown the connection if it's not configured to start at boot */ + smscconn_shutdown(conn, 0); + } success = 1; } } @@ -981,7 +986,7 @@ return rc; } -void smsc2_resume(void) +void smsc2_resume(int is_init) { SMSCConn *conn; long i; @@ -992,7 +997,12 @@ gw_rwlock_rdlock(&smsc_list_lock); for (i = 0; i < gwlist_len(smsc_list); i++) { conn = gwlist_get(smsc_list, i); - smscconn_start(conn); + if (!is_init || conn->start_at_boot) { + smscconn_start(conn); + } else { + /* Shutdown the connections that are not configured to start at boot */ + smscconn_shutdown(conn, 0); + } } gw_rwlock_unlock(&smsc_list_lock);