master
Sergey Dorofeev 13 years ago
parent 47267a1af6
commit 1b16ad9959

@ -36,7 +36,8 @@
* $INBOUND * $INBOUND
* $CONNECT, * $CONNECT,
* $CALLERID, * $CALLERID,
* $RC * $RC,
* $PEERNAME
*/ */
int session_run_command(const char *execstr) int session_run_command(const char *execstr)
{ {
@ -111,6 +112,10 @@ int session_run_command(const char *execstr)
if( state.cidstr && *state.cidstr ) if( state.cidstr && *state.cidstr )
exec_env_add(&eopts, "CALLERID", state.cidstr); exec_env_add(&eopts, "CALLERID", state.cidstr);
if( state.peername && *state.peername )
exec_env_add(&eopts, "PEERNAME", state.peername);
if( state.session_rc >= 0 ) if( state.session_rc >= 0 )
{ {

@ -311,14 +311,36 @@ int session_set_inbound(void)
struct stat st; struct stat st;
char *p_inb; char *p_inb;
if( (p_inb = conf_string(cf_inbound_directory)) ) p_inb = conf_string(cf_inbound_directory);
{ if( !p_inb ) {
state.inbound = (char*)xstrcpy(p_inb); log("no inbound specified, assume current directory");
p_inb = "./";
} }
else
{ if( conf_boolean(cf_split_inbound) ) {
log("no inbound specified, assume \"./\""); char buf[500];
state.inbound = (char*)xstrcpy("./"); if( state.node.addr.point ) {
sprintf( buf, "%s%d:%d/%d.%d/%s-in/",
p_inb,
state.node.addr.zone,
state.node.addr.net,
state.node.addr.node,
state.node.addr.point,
state.protected? "pwd": "unchecked" );
} else {
sprintf( buf, "%s%d:%d/%d/%s-in/",
p_inb,
state.node.addr.zone,
state.node.addr.net,
state.node.addr.node,
state.protected? "pwd": "unchecked" );
}
log("inbound: %s", buf);
state.inbound = (char*)xstrcpy(buf);
sprintf( buf, "/bin/mkdir -p %s -m 700", state.inbound );
system( buf );
} else {
state.inbound = (char*)xstrcpy(p_inb);
} }
state.tinbound = (char*)xstrcpy(state.inbound); state.tinbound = (char*)xstrcpy(state.inbound);

Loading…
Cancel
Save