Changed variable names of command line options

This commit is contained in:
Andreas Eversberg 2023-01-02 21:34:34 +01:00
parent a70bff87fc
commit 994c974074
3 changed files with 30 additions and 30 deletions

View File

@ -45,7 +45,7 @@ static int tx_delay = 0;
static int clip = 0;
static int cid_bell = 0;
static int cid_dtmf = 0;
static int cid_date = 0;
static int clip_date = 0;
static int enblock = 4;
static int recall = 0;
static int ringing_types_incoming[SUBSCRIBER_MAX] = { 0 };
@ -59,7 +59,7 @@ static const char *cc_argv[MAX_CC_ARGS];
static void print_usage(const char *app)
{
printf("Usage: %s -s <socketname> [<options>]\n", app);
printf("Usage: %s -s <socketname> [--clip --clip-date] [--recall] [<options>]\n", app);
}
static void print_help()
@ -71,8 +71,8 @@ static void print_help()
printf(" Give a config file to use. If it starts with '~/', path is at home dir.\n");
printf(" Each line in config file is one option, '-' or '--' must not be given!\n");
debug_print_help();
printf(" -s --socket <path>\n");
printf(" Path to UNIX socket that provides layer 1 connection to an PSTN device\n");
printf(" -s --socket <name>\n");
printf(" Abstract UNIX socket that provides layer 1 connection to a PSTN device\n");
printf(" -n --name <interface name>\n");
printf(" Give name of this interface. It will be sent in each call towards\n");
printf(" -I --subscriber <subscriber id>\n");
@ -85,17 +85,17 @@ static void print_help()
printf(" Give a delay in milliseconds. This is required for modem/fax. Audio\n");
printf(" toward ISDN interface is buffered with the given delay.\n");
printf(" This feature alters dejittering strategy.\n");
printf(" --clip [--cid-date]\n");
printf(" --clip [--clip-date]\n");
printf(" Enable caller ID, optionally with date info. (disabled by default)\n");
printf(" --clip-date\n");
printf(" Send date+time with caller ID.\n");
printf(" --cid-bell\n");
printf(" Use Bell 202 to modulate caller ID, rather than V.23 (default).\n");
printf(" Note that both systems are so similar (and have equal center frequency),\n");
printf(" Note that both systems are so similar (and have same center frequency),\n");
printf(" so that it does not matter which one is used. (my oppinion!)\n");
printf(" --cid-dtmf D\n");
printf(" Use DTMF with given start digit 'D' for default, rather than FSK.\n");
printf(" 'D' is used in Taiwan, 'A' in Brazil...\n");
printf(" --cid-date\n");
printf(" Send date+time with caller ID. (May cause errors on some phones.)\n");
printf(" --enblock off | <seconds>\n");
printf(" Enable en-block dialing, to collect number before setup. The value\n");
printf(" given is the number of seconds to wait for more digits to be dialed.\n");
@ -137,17 +137,17 @@ static void print_recall()
printf("\n");
}
#define OPT_TX_DELAY 256
#define OPT_TX_CLIP 257
#define OPT_TX_CID_BELL 258
#define OPT_TX_CID_DTMF 259
#define OPT_TX_CID_DATE 260
#define OPT_TX_ENBLOCK 261
#define OPT_TX_RECALL 262
#define OPT_TX_RING_I 'R'
#define OPT_TX_RING_H 264
#define OPT_ULAW 265
#define OPT_SERVING 266
#define OPT_TX_DELAY 256
#define OPT_TX_CLIP 257
#define OPT_TX_CLIP_DATE 258
#define OPT_TX_CID_BELL 259
#define OPT_TX_CID_DTMF 260
#define OPT_TX_ENBLOCK 261
#define OPT_TX_RECALL 262
#define OPT_TX_RING_I 'R'
#define OPT_TX_RING_H 264
#define OPT_ULAW 265
#define OPT_SERVING 266
static void add_options(void)
{
@ -158,9 +158,9 @@ static void add_options(void)
option_add('I', "subscriber", 1);
option_add(OPT_TX_DELAY, "tx-delay", 1);
option_add(OPT_TX_CLIP, "clip", 0);
option_add(OPT_TX_CLIP_DATE, "clip-date", 0);
option_add(OPT_TX_CID_BELL, "cid-bell", 0);
option_add(OPT_TX_CID_DTMF, "cid-dtmf", 1);
option_add(OPT_TX_CID_DATE, "cid-date", 0);
option_add(OPT_TX_ENBLOCK, "enblock", 1);
option_add(OPT_TX_RECALL, "recall", 0);
option_add(OPT_TX_RING_I, "ringing-type-incoming", 1);
@ -211,6 +211,9 @@ static int handle_options(int short_option, int argi, char **argv)
case OPT_TX_CLIP:
clip = 1;
break;
case OPT_TX_CLIP_DATE:
clip_date = 1;
break;
case OPT_TX_CID_BELL:
cid_bell = 1;
break;
@ -221,9 +224,6 @@ static int handle_options(int short_option, int argi, char **argv)
}
cid_dtmf = argv[argi][0];
break;
case OPT_TX_CID_DATE:
cid_date = 1;
break;
case OPT_TX_ENBLOCK:
enblock = atoi(argv[argi]);
break;
@ -333,7 +333,7 @@ int main(int argc, char *argv[])
if (!pstn_ep)
goto error;
rc = pstn_init(pstn_ep, name, socketname, subscribers, subscriber_num, serving_location, tx_delay, clip, cid_bell, cid_dtmf, cid_date, enblock, recall, ringing_types_incoming, ringing_type_hold, tones_type, law);
rc = pstn_init(pstn_ep, name, socketname, subscribers, subscriber_num, serving_location, tx_delay, clip, cid_bell, cid_dtmf, clip_date, enblock, recall, ringing_types_incoming, ringing_type_hold, tones_type, law);
if (rc) {
PDEBUG(DTEL, DEBUG_ERROR, "Endpoint initializing failed!\n");
goto error;

View File

@ -311,7 +311,7 @@ static void pstn_new_state(pstn_t *pstn, enum pstn_state state)
}
/* initialization and configuration of interface instance */
int pstn_init(pstn_t *pstn, const char *name, const char *socketname, const char **subscribers, int subscriber_num, uint8_t serving_location, int tx_delay, int clip, int cid_bell, int cid_dtmf, int cid_date, int enblock, int recall, int *ringing_types_incoming, int ringing_type_hold, enum tones_type tones_type, char law)
int pstn_init(pstn_t *pstn, const char *name, const char *socketname, const char **subscribers, int subscriber_num, uint8_t serving_location, int tx_delay, int clip, int cid_bell, int cid_dtmf, int clip_date, int enblock, int recall, int *ringing_types_incoming, int ringing_type_hold, enum tones_type tones_type, char law)
{
int i;
int rc;
@ -325,7 +325,7 @@ int pstn_init(pstn_t *pstn, const char *name, const char *socketname, const char
pstn->clip = clip;
pstn->cid_bell = cid_bell;
pstn->cid_dtmf = cid_dtmf;
pstn->cid_date = cid_date;
pstn->clip_date = clip_date;
pstn->enblock = enblock;
pstn->recall = recall;
pstn->ringing_types_incoming = ringing_types_incoming;
@ -358,7 +358,7 @@ int pstn_init(pstn_t *pstn, const char *name, const char *socketname, const char
if (rc < 0)
return rc;
PDEBUG(DTEL, DEBUG_DEBUG, "PSTN instance initialized (name=%s socketname=%s subscribers=%d, serving_location=%d, tx_delay=%d, clip=%d, cid_bell=%d, cid_dtmf=%d, cid_date=%d, enblock=%d, recall=%d, ringing_type_hold=%d\n", name, socketname, subscriber_num, serving_location, tx_delay, clip, cid_bell, cid_dtmf, cid_date, enblock, recall, ringing_type_hold);
PDEBUG(DTEL, DEBUG_DEBUG, "PSTN instance initialized (name=%s socketname=%s subscribers=%d, serving_location=%d, tx_delay=%d, clip=%d, cid_bell=%d, cid_dtmf=%d, clip_date=%d, enblock=%d, recall=%d, ringing_type_hold=%d\n", name, socketname, subscriber_num, serving_location, tx_delay, clip, cid_bell, cid_dtmf, clip_date, enblock, recall, ringing_type_hold);
for (i = 0; i < subscriber_num; i++)
PDEBUG(DTEL, DEBUG_DEBUG, " -> subscriber '%s', ringing_type_incoming %d\n", subscribers[i], ringing_types_incoming[i]);
@ -445,7 +445,7 @@ static void callerid_on(pstn_t *pstn, int cw, const char *callerid, uint8_t call
PDEBUG(DTEL, DEBUG_DEBUG, "Schedule caller ID transmission. (cw=%d, callerid=%s)\n", cw, callerid);
/* add DT_AS on waitng call */
callerid_set(&pstn->callerid, cw, (cw) ? 1 : 0, callerid, caller_type, pstn->cid_date);
callerid_set(&pstn->callerid, cw, (cw) ? 1 : 0, callerid, caller_type, pstn->clip_date);
if (cw) {
pstn->callerid_state = PSTN_CID_STATE_WAIT1;

View File

@ -103,9 +103,9 @@ typedef struct pstn {
int serving_location; /* who we serve when sending causes towards interface */
int tx_delay; /* delay to be used for fax/modem jitter buffering */
int clip; /* send caller ID */
int clip_date; /* send date with caller ID */
int cid_bell; /* use V.23 or Bell 202 FSK tones */
int cid_dtmf; /* use DTMF instead of FSK caller ID */
int cid_date; /* send date with caller ID */
int enblock; /* receive digits before transmitting them via SETUP message (timeout as given) */
int recall; /* support recall / waiting call */
int *ringing_types_incoming;/* cadenced rining on incoming call */
@ -142,7 +142,7 @@ typedef struct pstn {
void pstn_destroy(pstn_t *pstn_ep);
pstn_t *pstn_create(void);
int pstn_init(pstn_t *pstn, const char *name, const char *socketname, const char **subscribers, int subscriber_num, uint8_t serving_location, int tx_delay, int clip, int cid_bell, int cid_dtmf, int cid_date, int enblock, int recall, int *ringing_types_incoming, int ringing_type_hold, enum tones_type tones_type, char law);
int pstn_init(pstn_t *pstn, const char *name, const char *socketname, const char **subscribers, int subscriber_num, uint8_t serving_location, int tx_delay, int clip, int cid_bell, int cid_dtmf, int clip_date, int enblock, int recall, int *ringing_types_incoming, int ringing_type_hold, enum tones_type tones_type, char law);
void cc_message(osmo_cc_endpoint_t *ep, uint32_t callref, osmo_cc_msg_t *msg);
void rtp_work(pstn_t *pstn_ep);
void pstn_work(pstn_t *pstn_ep);