Skip to content

Instantly share code, notes, and snippets.

@thanosa75
Last active November 20, 2020 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save thanosa75/8abacca1b32d12c068d9964fc71e4806 to your computer and use it in GitHub Desktop.
Save thanosa75/8abacca1b32d12c068d9964fc71e4806 to your computer and use it in GitHub Desktop.
Asterisk: Postfix email relay to Gmail / OmniVOICE / OTE SIP Trunk
# 3 (emergency) or 5 digit numbers
1XX
ZXXXX
# 10 digit numbers incl mobile (6xxxx...) and land (2xxxx...)
ZXXXXXXXXX
# solution for saved numbers that have either 0030 or +30
# to go through the Greek OTE trunk
+30|6XXXXXXXXX
0030|6XXXXXXXXX
# intl. 3digit codes or 2digit codes (e.g. UK)
(00)+|ZXXZXXXXXXXXX
(00)+|ZXZXXXXXXXXX
(00)00|ZXXZXXXXXXXXX
(00)00|ZXZXXXXXXXXX
# add the items below last in main.cf (CentOS 7 only!):
# sets gmail as relay
relayhost = [smtp.gmail.com]:587
# use tls
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.trust.crt
smtp_sasl_security_options =
#to debug, comment out the 2 lines below
#debug_peer_list=smtp.gmail.com
#debug_peer_level=3
## ------
## sasl password file needs to contain a line like this (no #):
#[smtp.gmail.com]:587 <user@gmail.com>:<password>
## ------ then, use postmap sasl_passwd to create the DB
### In all cases, "<" and ">" should not be entered, e.g. +30<10digit phone#> == +302101112131
# General
# in "Trunk name": add the name
# in "Outbound CallerID" add the 10digit number
# set max channels to 2
# SIP Settings
# > Outgoing
# Trunk name: add a name here
# PEER Details:
context=from-trunk
fromuser=<accountId>
username=<accountId>
secret=<account secret>
fromdomain=sip.omnivoice.eu
host=sip.omnivoice.eu
port=5060
srvlookup=yes
insecure=invite,port
canreinvite=no
dtmfmode=rfc2833
t38pt_udptl=no
nat=yes
qualify=yes
type=peer
disallow=all
allow=g729&gsm&alaw
# > Incoming
# USER Context: the <accountId>
# USER Details:
secret=<account secret>
type=user
context=from-trunk
# Register String:
<accountId>:<account secret>@sip.omnivoice.eu/<accountId>
### In all cases, "<" and ">" should not be entered, e.g. +30<10digit phone#> == +302101112131
# General:
# Trunk name: add "OTE<10digit phone#>"
# Outbound caller id: add <10digit phone#>
# Maximum channels = 1
# Sip Settings:
# > Outgoing
# Trunk name: add "OTE<10digit phone#>"
# PEER details:
username=+30<10digit phone#>
type=peer
secret=<OTE secret>
host=ims.otenet.gr
fromuser=+30<10digit phone#>
qualify=yes
fromdomain=ims.otenet.gr
insecure=invite,port
nat=yes
# > Incoming
# USER context: +30<10digit phone#>
# USER Details:
type=user
secret=<OTE secret>
context=from-trunk
host=ims.otenet.gr
# Register String:
+30<10digit phone#>:<OTE secret>:+30<10digit phone#>@ims.otenet.gr@ims.otenet.gr:5060/+30<10digit phone#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment