hemantsonu20/sip-parser-antlr


A sip uri parser written using Antlr

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.hemantsonu20:sip-parser-antlr:sip-parser-antlr-1.0.0'
	}
	dependencies {
		implementation("com.github.hemantsonu20:sip-parser-antlr:sip-parser-antlr-1.0.0")
	}
	<dependency>
	    <groupId>com.github.hemantsonu20</groupId>
	    <artifactId>sip-parser-antlr</artifactId>
	    <version>sip-parser-antlr-1.0.0</version>
	</dependency>

                            
    libraryDependencies += "com.github.hemantsonu20" % "sip-parser-antlr" % "sip-parser-antlr-1.0.0"
        
        

                            
    :dependencies [[com.github.hemantsonu20/sip-parser-antlr "sip-parser-antlr-1.0.0"]]
        
        

Readme


sip-parser-antlr

Overview

A sip uri parser written with using antlr

The grammar of the sip uri is based on the RFC-3261 with some minor exceptions.

A typical sip-uri takes up the form

sip:hemant@github.com:80;uriparam1=urivalue1;uriparam2?headerkey1=headerValue1

The library parses this sip uri and returns a java class SipUriInfo. It has following fields.

private boolean isSips;
private String userInfo;
private String host;
private int port = -1;
private Map<String, String> uriParameters;
private Map<String, String> headers;

Examples

// to parse sip uri
SipUriInfo info = SipUtils.parseSipUri("sip:hemant@github.com:80;uriparam1=urivalue1;uriparam2?headerkey1=headerValue1");

// to parse sips uri
SipUriInfo info = SipUtils.parseSipsUri("sips:hemant@github.com:80;uriparam1=urivalue1;uriparam2?headerkey1=headerValue1");

For more examples see TestSipUtils

Maven Artifact

<dependency>
    <groupId>com.github.hemantsonu20</groupId>
    <artifactId>sip-parser-antlr</artifactId>
    <version>1.0.0</version>
</dependency>

Latest Published Version

1.0.0 published on July 13th 2016

License

Apache License 2.0