How to separate Outgoing Calls by Extension N°

Hi Everybody,

anyone known how to separate outgoing calls basing on Extensions n°

Example:

extensions 1 to 100 -> line 1
extensions 101 to 200 -> line 2

How to?

easy. in their channel definitions (Sip.conf zapata.conf etc) put them in a different context. then use includes. ie

[context1-200]
exten => _NXXNXXXXXX,1,Dial(SIP/provider1/${EXTEN})
include => otherstuff

[context201-300]
exten => _NXXNXXXXXX,1,Dial(Zap/G1/${EXTEN})
include => otherstuff

but this is an extensions.conf mod or sip.conf mod? How could I modify my files? Can you help me… I’m an Asterisk Newbie… :blush:

This is my extensions.conf

[general]
static=yes
writeprotect=yes
autofallthrough=yes
clearglobalvars=no
priorityjumping=no



[globals]
CONSOLE=Console/dsp				; Console interface for demo
TRUNKMSD=1		; MSD digits to strip (usually 1 or 0)
TRUNK=CAPI
ABOLI=SIP/41&SIP/42&SIP/53
CONMET=SIP/36
INGENIO=SIP/36&SIP/33&SIP/35
ALL=SIP/36&SIP/33&SIP/38&SIP/39
muales,6,Goto(from-sip,701,1)


[default]

;;; CHIAMATE DA ESTERNO

[from-isdn]

;;; CONTROLLO ORARIO UFFICIO/FERIE - MENU INIZIALE - SCELTA REPARTO

; Gestisce ferie estive, cambiare solo mese e giorni
exten => 0574536553,1,GotoIfTime(*|*|1-31|Aug?from-isdn,999,1) ; ES: Ferie dal 01 al 31 Agosto (compresi)
 ; Orario ufficio - MATTINA
exten => 0574536553,2,GotoIfTime(9:00-13:00|mon-fri|*|*?from-isdn,888,1)
 ; Orario ufficio - POMERIGGIO
exten => 0574536553,3,GotoIfTime(14:00-18:00|mon-fri|*|*?from-isdn,888,1)
exten => 0574536553,4,Goto(from-isdn,999,1)
; Gestisce ferie estive, cambiare solo mese e giorni
exten => 574536553,1,GotoIfTime(*|*|5-20|Aug?from-isdn,999,1)
 ; Orario ufficio - MATTINA
exten => 574536553,2,GotoIfTime(9:00-13:00|mon-fri|*|*?from-isdn,888,1)
 ; Orario ufficio - POMERIGGIO
exten => 574536553,3,GotoIfTime(14:00-18:00|mon-fri|*|*?from-isdn,888,1)
exten => 574536553,4,Goto(from-isdn,999,1)


;;; UFFICI CHIUSI - LASCIARE UN MESSAGGIO O USCIRE

exten => 999,1,Answer
exten => 999,2,Goto(from-sip,party,1)
exten => 999,3,VoiceMail(1234@default)
exten => 999,4,Background(arrivederci)
exten => 999,5,HangUp

;;; INTERROGARE VOICEMAIL

exten => 1000,1,Answer
exten => 1000,2,VoiceMailMain(1234@default)
exten => 1000,3,Background(arrivederci)
exten => 1000,4,HangUp

;;; CHIAMATE IN ARRIVO - ORARIO DI UFFICIO

exten => 888,1,Answer
exten => 888,2,Background(benvenuti)
exten => 888,3,Background(premere1)
exten => 888,4,Background(premere2)
exten => 888,5,Background(premere3)
exten => 888,6,Background(premere4)
exten => 888,7,WaitExten(5)
exten => 888,8,Background(errore)
exten => 888,9,Goto(from-isdn,888,1)


;;; PASSAGGIO ALL'ITERNO SCELTO DAL CLIENTE

exten => 1,1,Goto(from-sip,tech,1)
exten => 2,1,Goto(from-sip,sales,1)
exten => 3,1,Goto(from-sip,soft,1)
exten => 4,1,Goto(from-sip,admin,1)

exten => 5,1,Goto(from-sip,7000,1)

;;; INGENIO 
exten => 0574527441,1,Goto(from-sip,soft,1)
exten => 0574527441,2,Goto(from-sip,tech,1)
exten => 0574527441,3,Goto(from-sip,sales,1)
exten => 0574527441,4,Background(nessuno-disponibile)
exten => 0574527441,5,Hangup
exten => 574527441,1,Goto(from-sip,soft,1)
exten => 574527441,2,Goto(from-sip,tech,1)
exten => 574527441,3,Goto(from-sip,sales,1)
exten => 574527441,4,Background(nessuno-disponibile)
exten => 574527441,5,Hangup

;;; ABOLI
exten => 0574594566,1,Dial(SIP/43, 15, tr)
exten => 0574594566,2,Dial(SIP/41, 20, tr)
exten => 0574594566,3,Hangup
exten => 574594566,1,Dial(SIP/43, 15, tr)
exten => 574594566,2,Dial(SIP/41, 20, tr)
exten => 574594566,3,Hangup


;;; CHIMATE TRA INTERNI

[from-sip]
exten => 31,1,Dial(SIP/31,20,tr)
exten => 31,2,Hangup
exten => 32,1,Dial(SIP/32,20,tr)
exten => 32,2,Hangup
exten => 33,1,Dial(SIP/33,20,tr)
exten => 33,2,Hangup
exten => 35,1,Dial(SIP/35,20,tr)
exten => 35,2,Hangup
exten => 36,1,Dial(SIP/36,20,tr)
exten => 36,2,Hangup
exten => 37,1,Dial(SIP/37,20,tr)
exten => 37,2,Hangup
exten => 38,1,Dial(SIP/38,20,tr)
exten => 38,2,Hangup
exten => 39,1,Dial(SIP/39,20,tr)
exten => 39,2,Hangup
exten => 41,1,Dial(SIP/41,20,tr)
exten => 41,2,Hangup
exten => 42,1,Dial(SIP/42,20,tr)
exten => 42,2,Hangup
exten => 43,1,Dial(SIP/43,20,tr)
exten => 43,2,Hangup
exten => 666,1,Dial(SIP/666,20,tr)
exten => 666,2,Hangup
exten => 123,1,Dial(SIP/123,20,tr)
exten => 123,2,Hangup


;;; CHIAMA TUTTI GLI INTERNI SE NESSUNO RISPONDE ALTRIMENTI ENTRA IN SEGRETERIA

exten => party,1,Answer
exten => party,2,Background(trasferimento)
exten => party,3,Background(attendere)
exten => party,4,Set(CALLERID(all)= ${CALLERIDNUM})
exten => party,5,Dial(SIP/666&SIP/31&SIP/32&SIP/33&SIP/35&SIP/36&SIP/37&SIP/39&SIP/43&SIP/123&SIP/6000&SIP/7000,10,tr)
exten => party,6,Goto(from-sip,701,1)
exten => party,7,Background(arrivederci)
exten => party,8,HangUp

exten => ely,1,Answer
exten => ely,2,Background(trasferimento)
exten => ely,4,Set(CALLERID(all)= ${CALLERIDNUM})
exten => ely,5,Dial(SIP/36,15,tr)
exten => ely,6,Background(operatore)
exten => ely,7,Background(non-disponibile)
exten => ely,8,Hangup

exten => andrea,1,Answer
exten => andrea,2,Background(trasferimento)
exten => andrea,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => andrea,4,Dial(SIP/39,15,tr)
exten => andrea,5,Background(operatore)
exten => andrea,6,Background(non-disponibile)
exten => andrea,7,Hangup

exten => salve,1,Answer
exten => salve,2,Background(trasferimento)
exten => salve,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => salve,4,Dial(SIP/666,15,tr)
exten => salve,5,Background(operatore)
exten => salve,6,Background(non-disponibile)
exten => salve,7,Hangup

exten => piera,1,Answer
exten => piera,2,Background(trasferimento)
exten => piera,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => piera,4,Dial(SIP/32,15,tr)
exten => piera,5,Background(operatore)
exten => piera,6,Background(non-disponibile)
exten => piera,7,Hangup

exten => fidel,1,Answer
exten => fidel,2,Background(trasferimento)
exten => fidel,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => fidel,4,Dial(SIP/35,15,tr)
exten => fidel,5,Background(operatore)
exten => fidel,6,Background(non-disponibile)
exten => fidel,7,Hangup

exten => tamara,1,Answer
exten => tamara,2,Background(trasferimento)
exten => tamara,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => tamara,4,Dial(SIP/33,15,tr)
exten => tamara,5,Background(operatore)
exten => tamara,6,Background(non-disponibile)
exten => tamara,7,Hangup

exten => robe,1,Answer
exten => robe,2,Background(trasferimento)
exten => robe,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => robe,4,Dial(SIP/31,15,tr)
exten => robe,5,Background(operatore)
exten => robe,6,Background(non-disponibile)
exten => robe,7,Hangup

exten => vale,1,Answer
exten => vale,2,Background(trasferimento)
exten => vale,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => vale,4,Dial(SIP/37,15,tr)
exten => vale,5,Background(operatore)
exten => vale,6,Background(non-disponibile)
exten => vale,7,Hangup

exten => sandro,1,Answer
exten => sandro,2,Background(trasferimento)
exten => sandro,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => sandro,4,Dial(SIP/41,15,tr)
exten => sandro,5,Background(operatore)
exten => sandro,6,Background(non-disponibile)
exten => sandro,7,Hangup

exten => jessy,1,Answer
exten => jessy,2,Background(trasferimento)
exten => jessy,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => jessy,4,Dial(SIP/43,15,tr)
exten => jessy,5,Background(operatore)
exten => jessy,6,Background(non-disponibile)
exten => jessy,7,Hangup

;;; INTERNI SUDDIVISI PER CATEGORIA

;;; REP.COMMERCIALE

exten => sales,1,Answer
exten => sales,2,Background(trasferimento)
exten => sales,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => sales,4,Dial(SIP/39&SIP/32,15,tr)
exten => sales,5,Dial(SIP/36,8,tr)
exten => sales,6,Goto(from-sip,party,1)
exten => sales,7,Background(attendere)
exten => sales,8,Goto(from-sip,701,1)

;;; REP.TECNICO

exten => tech,1,Answer
exten => tech,2,Background(trasferimento)
exten => tech,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => tech,4,Dial(SIP/36,15,tr)
exten => tech,5,Dial(SIP/39&SIP/32&SIP/37,8,tr)
exten => tech,6,Goto(from-sip,party,1)
exten => tech,7,Background(attendere)
exten => tech,8,Goto(from-sip,701,1)

;; REP.SOFTWARE

exten => soft,1,Answer
exten => soft,2,Background(trasferimento)
exten => soft,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => soft,4,Dial(SIP/33&SIP/35,20,tr)
exten => soft,5,Dial(SIP/36,15,tr)
exten => soft,6,Goto(from-sip,party,1)
exten => soft,7,Background(attendere)
exten => soft,8,Goto(from-sip,701,1)

;;; AMMINISTRAZIONE

exten => admin,1,Answer
exten => admin,2,Background(trasferimento)
exten => admin,3,Set(CALLERID(all)= ${CALLERIDNUM})
exten => admin,4,Dial(SIP/36,15,tr)
exten => admin,5,Dial(SIP/32&SIP/39&SIP/43,20,tr)
exten => admin,6,Goto(from-sip,party,1)
exten => admin,7,Background(attendere)
exten => admin,8,Goto(from-sip,701,1)

;;; CANALE DI ATTESA

exten => 701,1,Answer
exten => 701,2,Background(tutti-occupati)
exten => 701,3,WaitMusicOnHold(30)
exten => 701,4,Goto(from-isdn,0574536553,1)

;;; REINVIO AI REPARTI

exten => 1,1,Goto(from-sip,tech,1)
exten => 2,1,Goto(from-sip,sales,1)
exten => 3,1,Goto(from-sip,soft,1)
exten => 4,1,Goto(from-sip,admin,1)


;;; PROVE VARIE

;exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
;exten => 500,2,Dial(IAX2/guest@misery.digium.com/s@default)
;exten => 500,3,Playback(demo-nogo)
;exten => 500,4,Hangup

;exten => 600,1,Answer
;exten => 600,2,SendUrl(http://www.conmet.it)
;exten => 600,3,Hangup


exten => 999,1,Answer
exten => 999,2,Goto(from-sip,party,1)
exten => 999,3,VoiceMail(1234@default)
exten => 999,4,Background(arrivederci)
exten => 999,5,HangUp


;; INTERROGARE VOICEMAIL

exten => 1000,1,Answer
exten => 1000,2,VoiceMailMain(1234@default)
exten => 1000,3,Background(arrivederci)
exten => 1000,4,HangUp




;;;  PROVA DI MATTEO PER IP PHONE 7906 CISCO - SEMPRE FROM-SIP

exten => 6000,1,SetCalledParty("Office <6000>")
exten => 6000,2,Dial(SCCP/6000)
exten => 6000,3,Hangup

exten => 7000,1,SetCalledParty("Andrea IP<7000>")
exten => 7000,2,Dial(SCCP/7000)
exten => 7000,3,Hangup


;exten => _X.,1,Dial(VISDN/visdn1.0/${EXTEN:${TRUNKMSD}}&VISDN/visdn1.1/${EXTEN:${TRUNKMSD}})


exten => s,1,VISDNOverlapDial()
exten => _X.,1,Dial(VISDN/visdn1.0/${EXTEN:${TRUNKMSD}})
exten => _X.,2,Dial(VISDN/visdn1.1/${EXTEN:${TRUNKMSD}})
exten => h,1,Congestion()


exten =>  _9X.,1,Dial(SIP/${EXTEN:${TRUNKMSD}}@eutelia-out,30,r)



//exten => _X.,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
//exten => _X.,1,Dial(mISDN/g:first_extern/${EXTEN:1},20,tr)[/code]

[b]this is my sip.conf[/b]


[code][general]
context=from-sip 		; Default context for incoming calls
realm=voip.eutelia.it
				; if asterisk was compiled with OSP support.
				; defaults to "asterisk"
				; Realms MUST be globally unique according to RFC 3261
				; Set this to your host name or domain name
bindport=5060			; UDP Port to bind to (SIP standard port is 5060)
bindaddr=0.0.0.0		; IP address to bind to (0.0.0.0 binds to all)
srvlookup=yes			; Enable DNS SRV lookups on outbound calls
				; Note: Asterisk only uses the first host 
				; in SRV records
				; Disabling DNS SRV lookups disables the 
				; ability to place SIP calls based on domain 
				; names to some other SIP users on the Internet
				
				; If configured, Asterisk will only allow
				; INVITE and REFER to non-local domains
				; Use "sip show domains" to list local domains
				; Add domain and configure incoming context
				; for external calls to this domain
				; You can have several "domain" settings
				; Default is yes
				; name and local IP to domain list.
				; and multiline formatted headers for strict
				; SIP compatibility (defaults to "no")
						; Message-Account in the MWI notify message 
						; defaults to "asterisk"
				; (see sip history / sip no history)

				; This may also be set for individual users/peers
				; This may also be set for individual users/peers
				; when we're not on hold
				; when we're on hold (must be > rtptimeout)
				; use 'never' to never use in-band signalling, even in cases
				; where some buggy devices might not render it
				; Valid values: yes, no, never Default: never
	                       	; Note that promiscredir when redirects are made to the
       	                	; local system will cause loops since SIP is incapable
       	                	; of performing a "hairpin" call.
				; a valid phone number
				; Other options: 
				; info : SIP INFO messages
				; inband : Inband audio (requires 64 kbit codec -alaw, ulaw)
				; auto : Use rfc2833 if offered, inband otherwise

				; the moment the channel loads this configuration
				; Useful to limit subscriptions to local extensions
				; Settable per peer/user also


register=0574026527:97MR3/XB89f1@voip.eutelia.it/0574026527

  
				; 0 = continue forever, hammering the other server until it 
				; accepts the registration
				; Default is 0 tries, continue forever


externip = 83.211.82.33
localnet = 172.16.200.0/24

				; if we're behind a NAT

				; The externip and localnet is used
				; when registering and communicating with other proxies
				; that we're registered with
				; external host, and Asterisk will 
				; perform DNS queries periodically.  Not
				; recommended for production 
				; environments!  Use externip instead
				; used
				; You may add multiple local networks.  A reasonable set of defaults
				; are:

nat=yes			; Global NAT settings  (Affects all peers and users)
                                ; yes = Always ignore info and assume NAT
                                ; no = Use NAT mode only according to RFC3581 
                                ; never = Never attempt NAT mode or RFC3581 support
				; route = Assume NAT, don't send rport 
				; (work around more UNIDEN bugs)

rtcachefriends=yes		; Cache realtime friends by adding them to the internal list
				; just like friends added from the config file only on a
				; as-needed basis? (yes|no)

rtupdate=yes			; Send registry updates to database using realtime? (yes|no)
				; If set to yes, when a SIP UA registers successfully, the ip address,
				; the origination port, the registration period, and the username of
				; the UA will be set to database via realtime. If not present, defaults to 'yes'.

rtautoclear=yes		; Auto-Expire friends created on the fly on the same schedule
				; as if it had just registered? (yes|no|<seconds>)
				; If set to yes, when the registration expires, the friend will vanish from
				; the configuration until requested again. If set to an integer,
				; friends expire within this number of seconds instead of the
				; registration interval.

				;
				; For non-realtime peers, when their registration expires, the information
				; will _not_ be removed from memory or the Asterisk database; if you attempt
				; to place a call to the peer, the existing information will be used in spite
				; of it having expired
				;
				; For realtime peers, when the peer is retrieved from realtime storage,
				; the registration information will be used regardless of whether
				; it has expired or not; if it expires while the realtime peer is still in
				; memory (due to caching or other reasons), the information will not be
				; removed from realtime storage


                          ; non-peers, use your primary domain "identity"
                          ; for From: headers instead of just your IP
                          ; address. This is to be polite and
                          ; it may be a mandatory requirement for some
                          ; destinations which do not have a prior
                          ; account relationship with your server. 

[authentication]





				; No registration allowed
				; from the phone to asterisk
				; (1 for the explicit peer, 1 for the explicit user,
				; remember that a friend equals 1 peer and 1 user in
				; memory)
disallow=all			; need to disallow=all before we can use allow=
allow=alaw
allow=ulaw			; Note: In user sections the order of codecs
				; listed with allow= does NOT matter!





                        ; sets the Message-Account in the MWI notify message
                        ; defaults to global vmexten which defaults to "asterisk"


				; Normally you do NOT need to set this parameter


				; Helps with NAT session
				; qualify=yes uses default value

				; Send SIP and RTP to the IP address that packet is 
				; received from instead of trusting SIP headers 
				; RTP media stream (audio) to go directly from
				; the caller to the callee.  Some devices do not
				; support this (especially if one of them is 
				; behind a NAT).
				; Normally you do NOT need to set this parameter
[31]
type=friend
username=31
callerid=Roberto Bolognini <31>
host=dynamic
context=from-sip
mailbox=1234@default

[32]
type=friend
username=32
callerid=Matteo Pierattini <32>
host=dynamic
context=from-sip
mailbox=1234@default

[33]
type=friend
username=33
callerid=Tamara Broche <33>
host=dynamic
context=from-sip
mailbox=1234@default

[35]
type=friend
username=35
callerid=Fidel Hernandez <35>
host=dynamic
context=from-sip
mailbox=1234@default

[36]
type=friend
username=36
callerid=Elisa Favi <36>
host=dynamic
context=from-sip
mailbox=1234@default

[37]
type=friend
username=37
callerid=Valentino Bellucci <37>
host=dynamic
context=from-sip
mailbox=1234@default

[39]
type=friend
username=39
callerid=Andrea Biancalani <39>
host=dynamic
context=from-sip
mailbox=1234@default

[41]
type=friend
username=41
callerid=Sandro Citerni <41>
host=dynamic
context=from-sip
mailbox=1234@default

[42]
type=friend
username=42
callerid=Fabrizio Fusi <42>
host=dynamic
context=from-sip
mailbox=1234@default

[43]
type=friend
username=43
callerid=Jessica Breschi <43>
host=dynamic
context=from-sip
mailbox=1234@default

[666]
type=friend
username=666
password=666
callerid=Matteo Salvestrini <666>
host=dynamic
context=from-sip
mailbox=1234@default

[123]
type=friend
username=123
callerid=Cordless Vagante <123>
host=dynamic
dtfmode=rfc2833
context=from-sip
mailbox=1234@default

[7000]
usernama=7000
secret=7000
type=friend
host=dynamic
allow=all
context=from-sip

[911]
type=friend
username=911
callerid= Interno <123>
host=dynamic
context=from-sip
mailbox=1234@default

[eutelia-out]
type=friend
callerid=0574026527
user=0574026527
username=0574026527
secret=97MR3/XB89f1
insecure=very
fromuser=0574026527
fromdomain=voip.eutelia.it
host=voip.eutelia.it
dtmfmode=rfc2833
context=from-sip
mailbox=1234@default

easy. right above the dial out area at the end split the context.
ie

exten => s,1,VISDNOverlapDial()
exten => _X.,1,Dial(VISDN/visdn1.0/${EXTEN:${TRUNKMSD}})
exten => _X.,2,Dial(VISDN/visdn1.1/${EXTEN:${TRUNKMSD}})
exten => h,1,Congestion()


exten =>  _9X.,1,Dial(SIP/${EXTEN:${TRUNKMSD}}@eutelia-out,30,r)



//exten => _X.,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
//exten => _X.,1,Dial(mISDN/g:first_extern/${EXTEN:1},20,tr)

should be its own context, call it outgoing1. in outgoing1, include => from-sip. Now make an outgoing2 context below that with whatever changes, and also include => from-sip. Now in sip.conf change for each line context=from-sip to be context=outgoing1 or context=outgoing2. both outgoing1 and 2 include from-sip, so the only diff is that one can access one set of dialing out and the other gets the other set.

So, for example, is I don’t missunderstood


extensions.conf

[context.1.100]

exten => s,1,VISDNOverlapDial()
exten => _X.,1,Dial(VISDN/visdn1.0/${EXTEN:${TRUNKMSD}})
exten => _X.,2,Dial(VISDN/visdn1.1/${EXTEN:${TRUNKMSD}})
exten => h,1,Congestion()
include => from-sip

[context.101.200]

exten => s,1,VISDNOverlapDial()
exten => _X.,1,Dial(SIP/${EXTEN:${TRUNKMSD}}@eutelia-out,30,r)
exten => h,1,Congestion()
include => from-sip

.


[context.901.1000]

sip.conf

[31]
type=friend
username=31
callerid= User31 <31>
host=dynamic
context=context.1.100
mailbox=1234@default

[310]
type=friend
username=310
callerid= User310 <310>
host=dynamic
context=context.301.400
mailbox=1234@default

is it correct?

yup

PeeeeeeeeerfecT! :laughing: