HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] modem ACL per user



Aidan Van Dyk wrote:

* Martin Vit <vit@xxxxxx> [051003 10:44]:



how to extract job owner? i've looked into job.h and there is no user/uid structure.
If i can modify dialstring based on job's owner (hylafax username) it would solve my problem.



man sendq...


and a bit of faxsend-wrapper could be roughly...

	[...]
	OWNER=$(grep '^owner:' $QFILE | cut -d : -f 2-)
	case $OWNER in
	[...]
	esac
	[...]

a.



this wrapper solved all features what i want (restrict modem use or better set DID). thanks for all, who helped me with this.


maybe this can help others:


add to /etc/hylafax/config
SendFaxCmd: /usr/local/bin/mysendfax.php
(in man hylafax-config, there is SendFaxCmd1, but this doesnt work. It must be SendFaxCmd. (hylafax version: debian 4.2.1-5)


cat /usr/local/bin/mysendfax.php:
-----
#!/usr/bin/php

<?
$spooldir = "/var/spool/hylafax";
$modem = $argv[2];
$qfile = $argv[3];
$def_cid = "242413000";

function get_cid($user) {
       switch($user) {
       case "festr":
               return "242413001";
               break;
       default:
               return $default_cid;
       }
}

if(!($fd = fopen("$spooldir/$qfile","r"))) {
       exit(-1);
}

$user = trim(system("grep '^owner:' $spooldir/$qfile | cut -d : -f 2"));
$cid = get_cid($user);

$data = '';
while(!feof($fd)) {
       $line = fgets($fd,4096);
       if(ereg("external:(.*)",$line,$regs)) {
               $data .= "external:$cid".'#'.$regs[1];
       } else if(ereg("number:(.*)",$line,$regs)) {
               $data .= "number:$cid".'#'.$regs[1];
       } else {
               $data .= $line;
       }
}
fclose($fd);
//odstranit lomitka z nazvu qfile
ereg("/([^/]*)$",$qfile,$regs);
$name = "/tmp/".$regs[1];
if(!($fd = fopen($name,"w"))) {;
       exit(-1);
}
fwrite($fd,$data);
fclose($fd);

system("/usr/sbin/faxsend -m $modem $name",$ret);
//important exit which tells hylafax, how the fax was processed
exit($ret);

?>




____________________ HylaFAX(tm) Users Mailing List _______________________ To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*




Project hosted by iFAX Solutions